public void AllMessagesShouldHaveBeenReceivedInOrder(bool instance2Sends, int messageCount, float dropChance, float skipChance) { SendManyMessages(instance2Sends, messageCount, dropChance, skipChance); // ---- asserts ---- // Assert.That(receives2, Has.Count.EqualTo(messageCount + 1)); Assert.That(receives1, Has.Count.EqualTo(instance2Sends ? messageCount + 1 : 0)); // check all message reached other side for (var i = 0; i < messageCount; i++) { var message = receives2[i]; var expected = instance1.message(i); AssertAreSameFromOffsets(expected, 0, message, 0, expected.Length); } if (instance2Sends) { for (var i = 0; i < messageCount; i++) { var message = receives1[i]; var expected = instance2.message(i); AssertAreSameFromOffsets(expected, 0, message, 0, expected.Length); } } }
public void PacketShouldContainMessage() { for (int i = 0; i < messageCount; i++) { AssertAreSameFromOffsets(instance1.message(i), 0, instance1.packet(i), AckSystem.NOTIFY_HEADER_SIZE, instance1.message(i).Length); } for (int i = 0; i < messageCount; i++) { AssertAreSameFromOffsets(instance2.message(i), 0, instance2.packet(i), AckSystem.NOTIFY_HEADER_SIZE, instance2.message(i).Length); } }