From b340397ad08353d47fa202c337f776b7cb03bae3 Mon Sep 17 00:00:00 2001 From: vis2k Date: Mon, 9 Aug 2021 16:42:48 +0800 Subject: [PATCH] NetworkServerTests: SendCommand test simplified --- Assets/Mirror/Tests/Editor/NetworkServerTest.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Assets/Mirror/Tests/Editor/NetworkServerTest.cs b/Assets/Mirror/Tests/Editor/NetworkServerTest.cs index 22a92c3d8..eedd861e8 100644 --- a/Assets/Mirror/Tests/Editor/NetworkServerTest.cs +++ b/Assets/Mirror/Tests/Editor/NetworkServerTest.cs @@ -762,17 +762,10 @@ public void SendCommand_CalledOnCorrectComponent() NetworkServer.Listen(1); ConnectClientBlockingAuthenticatedAndReady(out NetworkConnectionToClient connectionToClient); - // add an identity with two networkbehaviour components - CreateNetworked(out GameObject _, out NetworkIdentity identity, out CommandTestNetworkBehaviour comp0, out CommandTestNetworkBehaviour comp1); - identity.netId = 42; + // add an identity with two networkbehaviour components. + // spawned, otherwise command handler won't find it in .spawned. + CreateNetworkedAndSpawn(out GameObject _, out NetworkIdentity identity, out CommandTestNetworkBehaviour comp0, out CommandTestNetworkBehaviour comp1, connectionToClient); identity.isLocalPlayer = true; - // for authority check - identity.connectionToClient = connectionToClient; - connectionToClient.identity = identity; - - // identity needs to be in spawned dict, otherwise command handler - // won't find it - NetworkIdentity.spawned[identity.netId] = identity; // call the command comp1.TestCommand();