From 2fff5ef02bd946a718b089cf706dfc66ec789811 Mon Sep 17 00:00:00 2001 From: vis2k Date: Wed, 11 Aug 2021 14:13:59 +0800 Subject: [PATCH] Tests simplified --- .../Tests/Runtime/NetworkServerRuntimeTest.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Assets/Mirror/Tests/Runtime/NetworkServerRuntimeTest.cs b/Assets/Mirror/Tests/Runtime/NetworkServerRuntimeTest.cs index 50ee51d57..368bddbd5 100644 --- a/Assets/Mirror/Tests/Runtime/NetworkServerRuntimeTest.cs +++ b/Assets/Mirror/Tests/Runtime/NetworkServerRuntimeTest.cs @@ -14,23 +14,20 @@ public override IEnumerator UnitySetUp() { yield return base.UnitySetUp(); - // start server and wait 1 frame + // start server & client and wait 1 frame NetworkServer.Listen(1); + ConnectHostClientBlockingAuthenticatedAndReady(); yield return null; } [UnityTest] public IEnumerator DestroyPlayerForConnectionTest() { - CreateNetworked(out GameObject player, out _); - NetworkConnectionToClient conn = new NetworkConnectionToClient(1); - - // add player, wait 1 frame to spawn - NetworkServer.AddPlayerForConnection(conn, player); - yield return null; + // create spawned player + CreateNetworkedAndSpawnPlayer(out GameObject player, out _, NetworkServer.localConnection); // destroy player for connection, wait 1 frame to unspawn and destroy - NetworkServer.DestroyPlayerForConnection(conn); + NetworkServer.DestroyPlayerForConnection(NetworkServer.localConnection); yield return null; Assert.That(player == null, "Player should be destroyed with DestroyPlayerForConnection");