fix(NetworkServerTest): Updated tests (#3739)

- Expect Errors from PR #3737
This commit is contained in:
MrGadget 2024-01-19 09:39:05 -05:00 committed by GitHub
parent e1a1f49d0c
commit ac050a804d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -632,6 +632,7 @@ public void Send_ClientToServerMessage_UnknownMessageIdDisconnects()
// send a message without a registered handler // send a message without a registered handler
NetworkClient.Send(new TestMessage1()); NetworkClient.Send(new TestMessage1());
LogAssert.Expect(LogType.Error, $"NetworkServer: failed to unpack and invoke message. Disconnecting 1.");
ProcessMessages(); ProcessMessages();
// should have been disconnected // should have been disconnected
@ -684,6 +685,7 @@ public void Send_ServerToClientMessage_UnknownMessageIdDisconnects()
// send a message without a registered handler // send a message without a registered handler
connectionToClient.Send(new TestMessage1()); connectionToClient.Send(new TestMessage1());
LogAssert.Expect(LogType.Error, $"NetworkClient: failed to unpack and invoke message. Disconnecting.");
ProcessMessages(); ProcessMessages();
// should have been disconnected // should have been disconnected
@ -866,6 +868,7 @@ public void UnregisterHandler()
// unregister, send again, should not be called again // unregister, send again, should not be called again
NetworkServer.UnregisterHandler<TestMessage1>(); NetworkServer.UnregisterHandler<TestMessage1>();
NetworkClient.Send(new TestMessage1()); NetworkClient.Send(new TestMessage1());
LogAssert.Expect(LogType.Error, $"NetworkServer: failed to unpack and invoke message. Disconnecting 1.");
ProcessMessages(); ProcessMessages();
Assert.That(variant1Called, Is.EqualTo(1)); Assert.That(variant1Called, Is.EqualTo(1));
} }
@ -889,6 +892,7 @@ public void ClearHandler()
// clear handlers, send again, should not be called again // clear handlers, send again, should not be called again
NetworkServer.ClearHandlers(); NetworkServer.ClearHandlers();
NetworkClient.Send(new TestMessage1()); NetworkClient.Send(new TestMessage1());
LogAssert.Expect(LogType.Error, $"NetworkServer: failed to unpack and invoke message. Disconnecting 1.");
ProcessMessages(); ProcessMessages();
Assert.That(variant1Called, Is.EqualTo(1)); Assert.That(variant1Called, Is.EqualTo(1));
} }