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
ff4bc267e0
commit
2fff5ef02b
@ -14,23 +14,20 @@ public override IEnumerator UnitySetUp()
|
|||||||
{
|
{
|
||||||
yield return base.UnitySetUp();
|
yield return base.UnitySetUp();
|
||||||
|
|
||||||
// start server and wait 1 frame
|
// start server & client and wait 1 frame
|
||||||
NetworkServer.Listen(1);
|
NetworkServer.Listen(1);
|
||||||
|
ConnectHostClientBlockingAuthenticatedAndReady();
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator DestroyPlayerForConnectionTest()
|
public IEnumerator DestroyPlayerForConnectionTest()
|
||||||
{
|
{
|
||||||
CreateNetworked(out GameObject player, out _);
|
// create spawned player
|
||||||
NetworkConnectionToClient conn = new NetworkConnectionToClient(1);
|
CreateNetworkedAndSpawnPlayer(out GameObject player, out _, NetworkServer.localConnection);
|
||||||
|
|
||||||
// add player, wait 1 frame to spawn
|
|
||||||
NetworkServer.AddPlayerForConnection(conn, player);
|
|
||||||
yield return null;
|
|
||||||
|
|
||||||
// destroy player for connection, wait 1 frame to unspawn and destroy
|
// destroy player for connection, wait 1 frame to unspawn and destroy
|
||||||
NetworkServer.DestroyPlayerForConnection(conn);
|
NetworkServer.DestroyPlayerForConnection(NetworkServer.localConnection);
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
Assert.That(player == null, "Player should be destroyed with DestroyPlayerForConnection");
|
Assert.That(player == null, "Player should be destroyed with DestroyPlayerForConnection");
|
||||||
|
Loading…
Reference in New Issue
Block a user