Exemplo n.º 1
0
        public void ReadInt16LE_WithValidInt16_ReadsData()
        {
            using MemoryStream ms = new MemoryStream(new byte[] { 0xA0, 0x0 });
            using BinaryReader br = new BinaryReader(ms, new ASCIIEncoding());
            var result = EndianUtility.ReadInt16LE(br);

            Assert.Equal(160, result);
        }
Exemplo n.º 2
0
 public void ReadInt16LE_WithInvalidInt16_ThrowsException()
 {
     using MemoryStream ms = new MemoryStream(new byte[] { 0x10 });
     using BinaryReader br = new BinaryReader(ms, new ASCIIEncoding());
     Assert.Throws <System.IO.EndOfStreamException>(() => EndianUtility.ReadInt16LE(br));
 }