NetworkServerTest: RegisterUnregisterClearHandlerTest

This commit is contained in:
vis2k 2020-02-25 22:07:44 +01:00
parent 212af3fc9d
commit c2afc05692

View File

@ -712,7 +712,7 @@ public void SendToAllTest()
}
[Test]
public void RegisterHandlerTest()
public void RegisterUnregisterClearHandlerTest()
{
// message handlers that are needed for the test
NetworkServer.RegisterHandler<ConnectMessage>((conn, msg) => {}, false);
@ -759,8 +759,10 @@ public void RegisterHandlerTest()
LogAssert.ignoreFailingMessages = false;
Assert.That(variant1Called, Is.EqualTo(1)); // still 1, not 2
// unregister second handler, send, should fail
NetworkServer.UnregisterHandler<WovenTestMessage>();
// unregister second handler via ClearHandlers to test that one too. send, should fail
NetworkServer.ClearHandlers();
// (only add this one to avoid disconnect error)
NetworkServer.RegisterHandler<DisconnectMessage>((conn, msg) => {}, false);
writer = new NetworkWriter();
MessagePacker.Pack(new TestMessage(), writer);
// log error messages are expected