From 872032589284731dd3e950942f009b8fd50f7ae4 Mon Sep 17 00:00:00 2001 From: vis2k Date: Wed, 16 Jun 2021 12:38:27 +0800 Subject: [PATCH] NetworkServerTest: ReadyMessageSetsClientReady() simplified --- .../Mirror/Tests/Editor/NetworkServerTest.cs | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/Assets/Mirror/Tests/Editor/NetworkServerTest.cs b/Assets/Mirror/Tests/Editor/NetworkServerTest.cs index 6cb48cc72..990da773c 100644 --- a/Assets/Mirror/Tests/Editor/NetworkServerTest.cs +++ b/Assets/Mirror/Tests/Editor/NetworkServerTest.cs @@ -385,23 +385,14 @@ public void SetAllClientsNotReady() [Test] public void ReadyMessageSetsClientReady() { - // listen + // listen & connect NetworkServer.Listen(1); + ConnectClientBlockingAndAuthenticate(); + NetworkConnectionToClient connectionToClient = NetworkServer.connections.Values.First(); - // add connection - CreateLocalConnectionPair(out LocalConnectionToClient connectionToClient, out _); - NetworkServer.AddConnection(connectionToClient); - - // set as authenticated, otherwise readymessage is rejected - connectionToClient.isAuthenticated = true; - - // serialize a ready message into an arraysegment - byte[] message = MessagePackingTest.PackToByteArray(new ReadyMessage()); - - // call transport.OnDataReceived with the message - // -> calls NetworkServer.OnClientReadyMessage - // -> calls SetClientReady(conn) - transport.OnServerDataReceived.Invoke(0, new ArraySegment(message), 0); + // send ready message + NetworkClient.Ready(); + ProcessMessages(); Assert.That(connectionToClient.isReady, Is.True); }