Exemple #1
0
        public void DisconnectAllConnectionsTest()
        {
            // listen
            NetworkServer.Listen(1);
            Assert.That(NetworkServer.connections.Count, Is.EqualTo(0));

            // add connection
            NetworkConnectionToClient conn42 = new NetworkConnectionToClient(42, false, 0);

            NetworkServer.AddConnection(conn42);
            Assert.That(NetworkServer.connections.Count, Is.EqualTo(1));

            // disconnect all connections
            NetworkServer.DisconnectAllExternalConnections();
            Assert.That(NetworkServer.connections.Count, Is.EqualTo(0));
        }
Exemple #2
0
        public void DisconnectAllConnectionsTest()
        {
            // listen
            NetworkServer.Listen(1);
            Assert.That(NetworkServer.connections.Count, Is.EqualTo(0));

            // add connection
            NetworkConnectionToClient conn42 = new NetworkConnectionToClient(42, false, 0);

            NetworkServer.AddConnection(conn42);
            Assert.That(NetworkServer.connections.Count, Is.EqualTo(1));

            // disconnect all connections
            NetworkServer.DisconnectAllExternalConnections();

            // update transports. OnTransportDisconnected should be fired and
            // clear all connections.

            Assert.That(NetworkServer.connections.Count, Is.EqualTo(0));
        }