public void GetIPAddressThrowsExceptionWhenBufferHasLessThanFourBytes() { parser = new MessageParser(new byte[] { 1, 2, 3 }); ParseException e = Assert.ThrowsException <ParseException>(() => parser.GetIPAddress()); Assert.AreEqual("Insufficient bytes remaining: 3 < 4", e.Message); }
public void GetIPAddressRemovesBytesAsTheyAreReturned() { parser = new MessageParser(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }); _ = parser.GetIPAddress(); Assert.AreEqual(IPAddress.Parse("5.6.7.8"), parser.GetIPAddress()); }
public void GetIPAddressReturnsFirstFourBytesOfBufferAsNetworkOrderIPAddress() { parser = new MessageParser(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }); Assert.AreEqual(IPAddress.Parse("1.2.3.4"), parser.GetIPAddress()); }