public void ReadInt32LE_WithValidInt32_ReadsData() { using MemoryStream ms = new MemoryStream(new byte[] { 0x01, 0xEE, 0xA0, 0x0 }); using BinaryReader br = new BinaryReader(ms, new ASCIIEncoding()); var result = EndianUtility.ReadInt32LE(br); Assert.Equal(10546689, result); }
public void ReadInt32LE_WithInvalidInt32_ThrowsException() { using MemoryStream ms = new MemoryStream(new byte[] { 0x10, 0x00, 0xBB }); using BinaryReader br = new BinaryReader(ms, new ASCIIEncoding()); Assert.Throws <System.IO.EndOfStreamException>(() => EndianUtility.ReadInt32LE(br)); }