Exemplo n.º 1
0
        public void ReadByte_Correctly_Read_Bytes()
        {
            byte[] bufferData = { 4, 8, 7 };
            var buffer = new ArrayBuffer(bufferData, 0, bufferData.Length);

            byte byte1 = buffer.ReadByte();
            Assert.That(buffer.Length, Is.EqualTo(bufferData.Length - 1));
            byte byte2 = buffer.ReadByte();
            Assert.That(buffer.Length, Is.EqualTo(bufferData.Length - 2));

            Assert.That(bufferData[0], Is.EqualTo(byte1));
            Assert.That(bufferData[1], Is.EqualTo(byte2));
        }
Exemplo n.º 2
0
        public void ReadByte_Throws_Exception_If_Length_Is_Zero()
        {
            byte[] bufferData = { };
            var buffer = new ArrayBuffer(bufferData);

            Assert.That(() => buffer.ReadByte(), Throws.InstanceOf<InvalidOperationException>());
        }