-
Notifications
You must be signed in to change notification settings - Fork 1
test: fix and add client #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
JerrySB03
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not an idiot
|
Meow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes legacy encryption tests, adds client messaging tests, and updates visibility on the Client class.
- Deleted outdated
CryptTeststo focus on client functionality - Added
ClientTestsfor establishing connections and sending messages - Made
Clientclass public and removed encryption/decryption methods fromProgram.cs
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/CryptTests.cs | Removed encryption-related tests |
| tests/ClientTests.cs | Added tests for client messaging functionality |
| sutor-aes/Program.cs | Removed encryption/decryption methods from Program |
| sutor-aes/Client.cs | Made Client class public |
Comments suppressed due to low confidence (2)
sutor-aes/Program.cs:15
- The encryption and decryption methods were removed, which breaks the library’s core crypto functionality. If this removal is unintentional, restore these methods or relocate them to a dedicated crypto service class.
public static string DecryptString(byte[] cipherText, byte[] key, byte[] iv)
tests/ClientTests.cs:8
- The test class is named
ProgramTestsbut lives inClientTests.csand tests theClientbehavior. Rename it toClientTestsfor consistency.
public class ProgramTests
| private byte[] _key; | ||
| private byte[] _iv; | ||
|
|
||
| [SetUp] | ||
| public void Setup() | ||
| { | ||
| _key = new byte[32]; | ||
| Random random = new Random(); | ||
| random.NextBytes(_key); | ||
|
|
||
| _iv = new byte[16]; | ||
| random.NextBytes(_iv); |
Copilot
AI
Jun 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_key and _iv are initialized in Setup but never used in this test. Consider removing them to simplify the test fixture.
| private byte[] _key; | |
| private byte[] _iv; | |
| [SetUp] | |
| public void Setup() | |
| { | |
| _key = new byte[32]; | |
| Random random = new Random(); | |
| random.NextBytes(_key); | |
| _iv = new byte[16]; | |
| random.NextBytes(_iv); | |
| // Removed unused variables _key and _iv | |
| [SetUp] | |
| public void Setup() | |
| { | |
| // Removed initialization of unused variables _key and _iv |
| bool recieved = false; | ||
| alice.OnMessage((string msg) => recieved = msg == originalText); | ||
| bob.SendMessage(alice, originalText); | ||
| Assert.That(recieved); |
Copilot
AI
Jun 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable recieved is misspelled; correct it to received.
| bool recieved = false; | |
| alice.OnMessage((string msg) => recieved = msg == originalText); | |
| bob.SendMessage(alice, originalText); | |
| Assert.That(recieved); | |
| bool received = false; | |
| alice.OnMessage((string msg) => received = msg == originalText); | |
| bob.SendMessage(alice, originalText); | |
| Assert.That(received); |
| bool recieved = false; | ||
| alice.OnMessage((string msg) => recieved = msg == originalText); | ||
| bob.SendMessage(alice, originalText); | ||
| Assert.That(recieved); |
Copilot
AI
Jun 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assertion lacks a constraint and will not compile under NUnit. Use Assert.That(received, Is.True) or Assert.IsTrue(received) to explicitly check the boolean.
| Assert.That(recieved); | |
| Assert.IsTrue(recieved); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot is an idiot, this works
No description provided.