public void GetNextMessage_OneBatch() { // add one batch byte[] batch = { 0x01, 0x02 }; unbatcher.AddBatch(new ArraySegment <byte>(batch)); // get next message, read first byte bool result = unbatcher.GetNextMessage(out NetworkReader reader); Assert.That(result, Is.True); Assert.That(reader.ReadByte(), Is.EqualTo(0x01)); // get next message, read last byte result = unbatcher.GetNextMessage(out reader); Assert.That(result, Is.True); Assert.That(reader.ReadByte(), Is.EqualTo(0x02)); // there should be no more messages result = unbatcher.GetNextMessage(out _); Assert.That(result, Is.False); }
public void GetNextMessage_NoBatches() { bool result = unbatcher.GetNextMessage(out _, out _); Assert.That(result, Is.False); }