Skip to content

Commit

Permalink
test: updating exception in SocketLayer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Frowen committed Jul 9, 2024
1 parent 3ea2d5d commit 0f547f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void ThrowsIfTooManyMessageAreSent()
instance.ackSystem.Update();
}

var exception = Assert.Throws<InvalidOperationException>(() =>
var exception = Assert.Throws<BufferFullException>(() =>
{
instance.ackSystem.SendReliable(createRandomData(51));
instance.ackSystem.Update();
Expand Down Expand Up @@ -59,12 +59,12 @@ public void ThrowIfRingBufferIsfull()
instance.ackSystem.Update();
}

var exception = Assert.Throws<InvalidOperationException>(() =>
var exception = Assert.Throws<BufferFullException>(() =>
{
instance.ackSystem.SendReliable(createRandomData(0));
instance.ackSystem.Update();
});
var expected = new InvalidOperationException($"Sent queue is full for {instance.connection}");
var expected = new BufferFullException($"Sent queue is full for {instance.connection}");
Assert.That(exception, Has.Message.EqualTo(expected.Message));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void ThrowsIfTooBig()
// 3 byte header, so max size is over max
var bigBuffer = new byte[MAX_PACKET_SIZE - 2];

var exception = Assert.Throws<ArgumentException>(() =>
var exception = Assert.Throws<MessageSizeException>(() =>
{
_connection.SendReliable(bigBuffer);
});
Expand Down
2 changes: 1 addition & 1 deletion Assets/Tests/SocketLayer/PeerTestSendReceive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public void FragmentedSendThrowsIfTooBig()
{
var message = Enumerable.Range(10, maxFragmentMessageSize + 1).Select(x => (byte)x).ToArray();

Assert.Throws<ArgumentException>(() =>
Assert.Throws<MessageSizeException>(() =>
{
serverConnections[0].SendReliable(message);
});
Expand Down

0 comments on commit 0f547f8

Please sign in to comment.