Example #1
0
        public void TestVaruint()
        {
            var expected = new Varuint {
                Value = ushort.MaxValue
            };
            var actual = Roundtrip(expected, 3);

            Assert.AreEqual(expected.Value, actual.Value);
        }
        public void Deserialize(Stream stream, BinarySerialization.Endianness endianness,
                                BinarySerializationContext serializationContext)
        {
            var varuint = new Varuint {
                Value = Value
            };

            varuint.Deserialize(stream, endianness, serializationContext);
            Value = varuint.Value;
        }
        public void Serialize(Stream stream, BinarySerialization.Endianness endianness,
                              BinarySerializationContext serializationContext)
        {
            var boundedStream = (BoundedStream)stream;

            Assert.Equal(0, boundedStream.Position);
            Assert.Equal(100, boundedStream.MaxLength);

            var varuint = new Varuint {
                Value = Value
            };

            varuint.Serialize(stream, endianness, serializationContext);
        }