mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkServerTest: ReadyMessageSetsClientReady() simplified
This commit is contained in:
parent
5a9adcd9ed
commit
8720325892
@ -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<byte>(message), 0);
|
||||
// send ready message
|
||||
NetworkClient.Ready();
|
||||
ProcessMessages();
|
||||
Assert.That(connectionToClient.isReady, Is.True);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user