Пример #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, BinaryDataSerialization.Endianness endianness,
                                BinaryDataSerializationContext serializationContext)
        {
            var varuint = new Varuint {
                Value = Value
            };

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

            Assert.AreEqual(0, boundedStream.Position);
            Assert.AreEqual(100, (int)boundedStream.MaxLength.ByteCount);

            var varuint = new Varuint {
                Value = Value
            };

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