mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Tests simplified
This commit is contained in:
parent
2fff5ef02b
commit
52a560ca6d
@ -36,25 +36,19 @@ public IEnumerator DestroyPlayerForConnectionTest()
|
|||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator RemovePlayerForConnectionTest()
|
public IEnumerator RemovePlayerForConnectionTest()
|
||||||
{
|
{
|
||||||
GameObject player = new GameObject("testPlayer", typeof(NetworkIdentity));
|
// create spawned player
|
||||||
NetworkConnectionToClient conn = new NetworkConnectionToClient(1);
|
CreateNetworkedAndSpawnPlayer(out GameObject player, out _, NetworkServer.localConnection);
|
||||||
|
|
||||||
NetworkServer.AddPlayerForConnection(conn, player);
|
// remove player for connection, wait 1 frame to unspawn
|
||||||
|
NetworkServer.RemovePlayerForConnection(NetworkServer.localConnection, false);
|
||||||
// allow 1 frame to spawn object
|
|
||||||
yield return null;
|
|
||||||
|
|
||||||
NetworkServer.RemovePlayerForConnection(conn, false);
|
|
||||||
|
|
||||||
// allow 1 frame to unspawn object
|
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
Assert.That(player, Is.Not.Null, "Player should be not be destroyed");
|
Assert.That(player, Is.Not.Null, "Player should be not be destroyed");
|
||||||
Assert.That(conn.identity == null, "identity should be null");
|
Assert.That(NetworkServer.localConnection.identity == null, "identity should be null");
|
||||||
|
|
||||||
// respawn player
|
// respawn player
|
||||||
NetworkServer.AddPlayerForConnection(conn, player);
|
NetworkServer.AddPlayerForConnection(NetworkServer.localConnection, player);
|
||||||
Assert.That(conn.identity != null, "identity should not be null");
|
Assert.That(NetworkServer.localConnection.identity != null, "identity should not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
|
Loading…
Reference in New Issue
Block a user