public void GetByteThrowsParseExceptionWhenBufferIsEmpty() { parser = new MessageParser(new byte[] { }); ParseException e = Assert.ThrowsException <ParseException>(() => parser.GetByte()); Assert.AreEqual("Insufficient bytes remaining: 0 < 1", e.Message); }
public void GetByteRemovesByteAsItIsReturned() { parser = new MessageParser(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }); _ = parser.GetByte(); Assert.AreEqual(2, parser.GetByte()); }
public void GetByteReturnsFirstByteOfBuffer() { parser = new MessageParser(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }); Assert.AreEqual(1, parser.GetByte()); }
public void GetStringRemovesBytesIncludingZeroByteAsTheyAreReturned() { parser = new MessageParser(new byte[] { 72, 105, 0, 66, 121, 101 }); _ = parser.GetString(); Assert.AreEqual(66, parser.GetByte()); }