public void GetBytesThrowsParseExceptionWhenBufferHasInsufficientBytes()
        {
            parser = new MessageParser(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 });
            ParseException e = Assert.ThrowsException <ParseException>(() => parser.GetBytes(9));

            Assert.AreEqual("Insufficient bytes remaining: 8 < 9", e.Message);
        }
 public void GetBytesRemovesBytseAsTheyAreReturned()
 {
     parser = new MessageParser(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 });
     _      = parser.GetBytes(4);
     CollectionAssert.AreEqual(new byte[] { 5, 6 }, parser.GetBytes(2));
 }
 public void GetBytesReturnsFirstNBytesOfBuffer()
 {
     parser = new MessageParser(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 });
     CollectionAssert.AreEqual(new byte[] { 1, 2, 3, 4 }, parser.GetBytes(4));
 }