public void ReadInt16BE_WithValidInt16_ReadsData() { using MemoryStream ms = new MemoryStream(new byte[] { 0xA0, 0x0 }); using BinaryReader br = new BinaryReader(ms, new ASCIIEncoding()); var result = EndianUtility.ReadInt16BE(br); Assert.Equal(-24576, result); }
public void ReadInt16BE_WithInvalidInt16_ThrowsException() { using MemoryStream ms = new MemoryStream(new byte[] { 0x10 }); using BinaryReader br = new BinaryReader(ms, new ASCIIEncoding()); Assert.Throws <System.IO.EndOfStreamException>(() => EndianUtility.ReadInt16BE(br)); }