public void ActionPacketInUnloadedChunk() { Packet packet = new TestActionPacket(playerId, unloadedActionPosition); packetReceiver.PacketReceived(packet); Queue <Packet> packets = packetReceiver.GetReceivedPackets(); Assert.AreEqual(0, packets.Count); }
public void ActionPacketInUnloadedCell() { Packet packet = new TestActionPacket(unloadedActionPosition, CELL_LEVEL); packetReceiver.PacketReceived(packet); Queue <Packet> packets = packetReceiver.GetReceivedPackets(); Assert.AreEqual(0, packets.Count); }
public void ActionPacketInLoadedCell() { Packet packet = new TestActionPacket(loadedActionPosition); packetReceiver.PacketReceived(packet); Queue <Packet> packets = packetReceiver.GetReceivedPackets(); Assert.AreEqual(1, packets.Count); Assert.AreEqual(packet, packets.Dequeue()); }
public void PacketPrioritizedAfterBeingDeferred() { Packet packet1 = new TestActionPacket(playerId, unloadedActionPosition); packetReceiver.PacketReceived(packet1); Assert.AreEqual(0, packetReceiver.GetReceivedPackets().Count); Packet packet2 = new TestNonActionPacket(playerId); packetReceiver.PacketReceived(packet2); loadedChunks.Add(unloadedChunk); packetReceiver.ChunkLoaded(unloadedChunk); Queue <Packet> packets = packetReceiver.GetReceivedPackets(); Assert.AreEqual(2, packets.Count); Assert.AreEqual(packet1, packets.Dequeue()); Assert.AreEqual(packet2, packets.Dequeue()); }
public void PacketPrioritizedAfterBeingDeferred() { Packet packet1 = new TestActionPacket(unloadedActionPosition); packetReceiver.PacketReceived(packet1); Assert.AreEqual(0, packetReceiver.GetReceivedPackets().Count); Packet packet2 = new TestNonActionPacket(PLAYER_ID); packetReceiver.PacketReceived(packet2); visibleCells.Add(unloadedCell); packetReceiver.CellLoaded(unloadedCell); Queue <Packet> packets = packetReceiver.GetReceivedPackets(); Assert.AreEqual(2, packets.Count); Assert.AreEqual(packet1, packets.Dequeue()); Assert.AreEqual(packet2, packets.Dequeue()); }