Ejemplo n.º 1
0
        public void TestEmptyObject()
        {
            TableType obj              = null;
            var       serializer       = new TableSerializer(new BaseSerializer[] { new ByteSerializer(1), new UInt32Serializer(2) });
            var       optionSerializer = new OptionSerializer <TableType, TableSerializer>(obj, serializer);
            var       expected         = System.Array.Empty <byte>();

            Assert.Equal(expected, optionSerializer.Serialize());
        }
Ejemplo n.º 2
0
        public void TestNonEmptyObject()
        {
            var obj              = new TableType(0x01, 2);
            var serializer       = new TableSerializer(new BaseSerializer[] { new ByteSerializer(obj.F1), new UInt32Serializer(obj.F2) });
            var optionSerializer = new OptionSerializer <TableType, TableSerializer>(obj, serializer);
            var expected         = new byte[]
            {
                17, 0, 0, 0, 12, 0, 0, 0, 13, 0, 0, 0, 1, 2, 0, 0, 0
            };

            Assert.Equal(expected, optionSerializer.Serialize());
        }