-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,39 @@ | ||||||||||||||||||||||
| using System; | ||||||||||||||||||||||
| using System.Text; | ||||||||||||||||||||||
| using NUnit.Framework; | ||||||||||||||||||||||
| using SutorAes; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| namespace tests; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| 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); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| [Test] | ||||||||||||||||||||||
| public void EstablishConnection_SendMessage() | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| string originalText = "This is a test message for encryption and decryption"; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Client bob = new Client("Bob"); | ||||||||||||||||||||||
| Client alice = new Client("Alice"); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| bob.EstablishConnection(alice); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| bool recieved = false; | ||||||||||||||||||||||
| alice.OnMessage((string msg) => recieved = msg == originalText); | ||||||||||||||||||||||
| bob.SendMessage(alice, originalText); | ||||||||||||||||||||||
| Assert.That(recieved); | ||||||||||||||||||||||
|
Comment on lines
+34
to
+37
|
||||||||||||||||||||||
| 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); |
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
This file was deleted.
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.
_keyand_ivare initialized inSetupbut never used in this test. Consider removing them to simplify the test fixture.