mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
NetworkIdentityTests: RebuildObserversDoesNotAddServerConnectionsIfImplemented
This commit is contained in:
parent
9c09c26a5c
commit
8e6f5ba89c
@ -1417,5 +1417,33 @@ public void RebuildObserversAddsReadyServerConnectionsIfNotImplemented()
|
|||||||
NetworkServer.Shutdown();
|
NetworkServer.Shutdown();
|
||||||
Transport.activeTransport = null;
|
Transport.activeTransport = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void RebuildObserversDoesNotAddServerConnectionsIfImplemented()
|
||||||
|
{
|
||||||
|
// AddObserver will call transport.send and validpacketsize, so we
|
||||||
|
// actually need a transport
|
||||||
|
Transport.activeTransport = new MemoryTransport();
|
||||||
|
|
||||||
|
// add a server connection
|
||||||
|
NetworkServer.connections[12] = new NetworkConnectionToClient(12){isReady = true};
|
||||||
|
|
||||||
|
// add at least one observers component, otherwise it will just add
|
||||||
|
// all server connections
|
||||||
|
gameObject.AddComponent<RebuildEmptyObserversNetworkBehaviour>();
|
||||||
|
|
||||||
|
// call OnStartServer so that observers dict is created
|
||||||
|
identity.OnStartServer();
|
||||||
|
|
||||||
|
// rebuild observers should NOT add all server connections now
|
||||||
|
identity.RebuildObservers(true);
|
||||||
|
Assert.That(identity.observers.Count, Is.EqualTo(0));
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
NetworkServer.Shutdown();
|
||||||
|
Transport.activeTransport = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: // rebuild observers does NOT add a honeypot server conn if any comp implements it?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user