mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
NetworkServerTest: DisconnectAllTest
This commit is contained in:
parent
357ad0ffb6
commit
1cce3164b9
@ -286,6 +286,37 @@ public void DisconnectAllConnectionsTest()
|
|||||||
NetworkServer.Shutdown();
|
NetworkServer.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void DisconnectAllTest()
|
||||||
|
{
|
||||||
|
// message handlers
|
||||||
|
NetworkServer.RegisterHandler<ConnectMessage>((conn, msg) => {}, false);
|
||||||
|
NetworkServer.RegisterHandler<DisconnectMessage>((conn, msg) => {}, false);
|
||||||
|
NetworkServer.RegisterHandler<ErrorMessage>((conn, msg) => {}, false);
|
||||||
|
|
||||||
|
// listen
|
||||||
|
NetworkServer.Listen(1);
|
||||||
|
Assert.That(NetworkServer.connections.Count, Is.EqualTo(0));
|
||||||
|
|
||||||
|
// set local connection
|
||||||
|
ULocalConnectionToClient localConnection = new ULocalConnectionToClient();
|
||||||
|
NetworkServer.SetLocalConnection(localConnection);
|
||||||
|
Assert.That(NetworkServer.localConnection, Is.EqualTo(localConnection));
|
||||||
|
|
||||||
|
// add connection
|
||||||
|
NetworkConnectionToClient conn42 = new NetworkConnectionToClient(42);
|
||||||
|
NetworkServer.AddConnection(conn42);
|
||||||
|
Assert.That(NetworkServer.connections.Count, Is.EqualTo(1));
|
||||||
|
|
||||||
|
// disconnect all connections and local connection
|
||||||
|
NetworkServer.DisconnectAll();
|
||||||
|
Assert.That(NetworkServer.connections.Count, Is.EqualTo(0));
|
||||||
|
Assert.That(NetworkServer.localConnection, Is.Null);
|
||||||
|
|
||||||
|
// shutdown
|
||||||
|
NetworkServer.Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ShutdownCleanupTest()
|
public void ShutdownCleanupTest()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user