Пример #1
0
        public void UnmarkedFieldsAreNotSerialized()
        {
            var original = new SomeClassWithSerializers {
                IntField = 2, IntProperty = 30, UnmarkedField = 12, UnmarkedProperty = 47
            };
            var result = RoundTripThroughCodec(original);

            Assert.NotEqual(original.UnmarkedField, result.UnmarkedField);
            Assert.NotEqual(original.UnmarkedProperty, result.UnmarkedProperty);
        }
Пример #2
0
        public void GeneratedSerializersRoundTripThroughSerializer()
        {
            var original = new SomeClassWithSerializers {
                IntField = 2, IntProperty = 30
            };
            var result = (SomeClassWithSerializers)RoundTripThroughUntypedSerializer(original, out _);

            Assert.Equal(original.IntField, result.IntField);
            Assert.Equal(original.IntProperty, result.IntProperty);
        }
        public void GeneratedSerializersRoundTripThroughCodec()
        {
            var original = new SomeClassWithSerializers {
                IntField = 2, IntProperty = 30
            };
            var result = RoundTripThroughCodec(original);

            Assert.Equal(original.IntField, result.IntField);
            Assert.Equal(original.IntProperty, result.IntProperty);
        }
Пример #4
0
        public void GeneratedSerializersRoundTripThroughCodec()
        {
            var original = new SomeClassWithSerializers {
                IntField = 2, IntProperty = 30, OtherObject = MyCustomEnum.Two
            };
            var result = RoundTripThroughCodec(original);

            Assert.Equal(original.IntField, result.IntField);
            Assert.Equal(original.IntProperty, result.IntProperty);
            var otherObj = Assert.IsType <MyCustomEnum>(result.OtherObject);

            Assert.Equal(MyCustomEnum.Two, otherObj);
        }