Example #1
0
        public void Deserialize()
        {
            byte[]       data   = new byte[] { 66, 32, 32, 32, 32, 32, 32, 32, 32, 32 };
            MemoryReader reader = new(data);

            uut.Deserialize(ref reader);
            var span = uut.Value.Span;

            span.Length.Should().Be(10);
            span[0].Should().Be(0x42);
            for (int i = 1; i < 10; i++)
            {
                span[i].Should().Be(0x20);
            }
        }
Example #2
0
        public void Deserialize()
        {
            byte[] data  = new byte[] { 0, 10, 66, 32, 32, 32, 32, 32, 32, 32, 32, 32, 0 };
            int    index = 0;

            using (MemoryStream ms = new MemoryStream(data, index, data.Length - index, false))
            {
                using (BinaryReader reader = new BinaryReader(ms))
                {
                    uut.Deserialize(reader);
                }
            }
            uut.Value.Length.Should().Be(10);
            uut.Value[0].Should().Be(0x42);
            for (int i = 1; i < 10; i++)
            {
                uut.Value[i].Should().Be(0x20);
            }
        }