NetworkServerTest: RemoveConnection cleanup

This commit is contained in:
vis2k 2021-06-15 13:34:55 +08:00
parent 86f83da2d9
commit 42de58c9e9

View File

@ -308,19 +308,14 @@ public void RemoveConnection()
{
// listen
NetworkServer.Listen(1);
Assert.That(NetworkServer.connections.Count, Is.EqualTo(0));
// add connection
NetworkConnectionToClient conn42 = new NetworkConnectionToClient(42, false);
bool result42 = NetworkServer.AddConnection(conn42);
Assert.That(result42, Is.True);
Assert.That(NetworkServer.AddConnection(conn42), Is.True);
Assert.That(NetworkServer.connections.Count, Is.EqualTo(1));
Assert.That(NetworkServer.connections.ContainsKey(42), Is.True);
Assert.That(NetworkServer.connections[42], Is.EqualTo(conn42));
// remove connection
bool resultRemove = NetworkServer.RemoveConnection(42);
Assert.That(resultRemove, Is.True);
Assert.That(NetworkServer.RemoveConnection(42), Is.True);
Assert.That(NetworkServer.connections.Count, Is.EqualTo(0));
}