Пример #1
0
        public void ReadInt32BE_WithValidInt32_ReadsData()
        {
            using MemoryStream ms = new MemoryStream(new byte[] { 0xA0, 0x01, 0xBE, 0x0 });
            using BinaryReader br = new BinaryReader(ms, new ASCIIEncoding());
            var result = EndianUtility.ReadInt32BE(br);

            Assert.Equal(-1610498560, result);
        }
Пример #2
0
 public void ReadInt32BE_WithInvalidInt32_ThrowsException()
 {
     using MemoryStream ms = new MemoryStream(new byte[] { 0x10, 0xFF, 0xFF });
     using BinaryReader br = new BinaryReader(ms, new ASCIIEncoding());
     Assert.Throws <System.IO.EndOfStreamException>(() => EndianUtility.ReadInt32BE(br));
 }