mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
NetworkServerTest: ReadyMessageSetsClientReady cleanup
This commit is contained in:
parent
092ff4538a
commit
26e18d7e87
@ -427,7 +427,6 @@ public void ReadyMessageSetsClientReady()
|
|||||||
{
|
{
|
||||||
// listen
|
// listen
|
||||||
NetworkServer.Listen(1);
|
NetworkServer.Listen(1);
|
||||||
Assert.That(NetworkServer.connections.Count, Is.EqualTo(0));
|
|
||||||
|
|
||||||
// add connection
|
// add connection
|
||||||
CreateLocalConnectionPair(out LocalConnectionToClient connectionToClient, out _);
|
CreateLocalConnectionPair(out LocalConnectionToClient connectionToClient, out _);
|
||||||
@ -437,17 +436,12 @@ public void ReadyMessageSetsClientReady()
|
|||||||
connectionToClient.isAuthenticated = true;
|
connectionToClient.isAuthenticated = true;
|
||||||
|
|
||||||
// serialize a ready message into an arraysegment
|
// serialize a ready message into an arraysegment
|
||||||
ReadyMessage message = new ReadyMessage();
|
byte[] message = MessagePackingTest.PackToByteArray(new ReadyMessage());
|
||||||
NetworkWriter writer = new NetworkWriter();
|
|
||||||
MessagePacking.Pack(message, writer);
|
|
||||||
ArraySegment<byte> segment = writer.ToArraySegment();
|
|
||||||
|
|
||||||
// call transport.OnDataReceived with the message
|
// call transport.OnDataReceived with the message
|
||||||
// -> calls NetworkServer.OnClientReadyMessage
|
// -> calls NetworkServer.OnClientReadyMessage
|
||||||
// -> calls SetClientReady(conn)
|
// -> calls SetClientReady(conn)
|
||||||
transport.OnServerDataReceived.Invoke(0, segment, 0);
|
transport.OnServerDataReceived.Invoke(0, new ArraySegment<byte>(message), 0);
|
||||||
|
|
||||||
// ready?
|
|
||||||
Assert.That(connectionToClient.isReady, Is.True);
|
Assert.That(connectionToClient.isReady, Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user