Esempio n. 1
0
        public void ReadUShort_ThrowsOnInvalidBuffer()
        {
            var buffer = new byte[]
            {
                (byte)'0',
                (byte)'0',
                (byte)'0',
            };

            Assert.Throws <ArgumentException>(() => HexPrimitives.ReadUShort(buffer));
        }
Esempio n. 2
0
        public void WriteUInt16_ValueInMemory()
        {
            Span <byte> buffer = new byte[4];

            HexPrimitives.WriteUInt16(12, buffer);

            Assert.Equal((byte)'0', buffer[0]);
            Assert.Equal((byte)'0', buffer[1]);
            Assert.Equal((byte)'0', buffer[2]);
            Assert.Equal((byte)'C', buffer[3]);
        }
Esempio n. 3
0
        public void ReadUShort_ValueFromMemory()
        {
            Span <byte> buffer = new byte[]
            {
                (byte)'0',
                (byte)'0',
                (byte)'0',
                (byte)'C',
            };

            var value = HexPrimitives.ReadUShort(buffer);

            Assert.Equal(12, value);
        }