mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkServerTest: SetLocalConnection split into two tests
This commit is contained in:
parent
37c972658e
commit
64e8697031
@ -192,7 +192,6 @@ public void ConnectDuplicateConnectionIds()
|
||||
{
|
||||
// listen
|
||||
NetworkServer.Listen(2);
|
||||
Assert.That(NetworkServer.connections.Count, Is.EqualTo(0));
|
||||
|
||||
// connect first
|
||||
transport.OnServerConnected.Invoke(42);
|
||||
@ -215,12 +214,22 @@ public void SetLocalConnection()
|
||||
LocalConnectionToClient localConnection = new LocalConnectionToClient();
|
||||
NetworkServer.SetLocalConnection(localConnection);
|
||||
Assert.That(NetworkServer.localConnection, Is.EqualTo(localConnection));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetLocalConnection_PreventsOverwrite()
|
||||
{
|
||||
// listen
|
||||
NetworkServer.Listen(1);
|
||||
|
||||
// set local connection
|
||||
LocalConnectionToClient localConnection = new LocalConnectionToClient();
|
||||
NetworkServer.SetLocalConnection(localConnection);
|
||||
|
||||
// try to overwrite it, which should not work
|
||||
// (it will show an error message, which is expected)
|
||||
LogAssert.ignoreFailingMessages = true;
|
||||
LocalConnectionToClient overwrite = new LocalConnectionToClient();
|
||||
NetworkServer.SetLocalConnection(overwrite);
|
||||
NetworkServer.SetLocalConnection(new LocalConnectionToClient());
|
||||
Assert.That(NetworkServer.localConnection, Is.EqualTo(localConnection));
|
||||
LogAssert.ignoreFailingMessages = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user