Пример #1
0
        public void Reads_Four_Byte_Integer()
        {
            var buffer = new byte[] { 0x00, 0x00, 0x30, 0x39 };

            var reader = new PduReader(buffer);

            Assert.AreEqual(12345, reader.ReadInteger());
        }
Пример #2
0
        public void Throw_On_Read_Four_Byte_Integer_With_Insufficient_Bytes()
        {
            var buffer = new byte[] {
                0x63, 0xf1, 0x23
            };

            var reader = new PduReader(buffer);

            Assert.Throws(typeof(InvalidOperationException), () => reader.ReadInteger(), "Buffer does not contain 4 bytes.");
        }