示例#1
0
        public void Deserialize_Object_With_Private_Field_And_Property()
        {
            var dummy = new Dummy7(_fixture.Create <int>(), _fixture.Create <DateTime>());

            var serializer = new SwiftySendSerializer(typeof(Dummy7));
            var result     = serializer.Deserialize <Dummy7>(XmlRepresentation.GetXml(dummy));

            var propertyValue = typeof(Dummy7).GetProperty("IntPrivateProperty", BindingFlags.Instance | BindingFlags.NonPublic);
            var fieldValue    = typeof(Dummy7).GetField("DateTimePrivateField", BindingFlags.Instance | BindingFlags.NonPublic);

            Assert.Equal(propertyValue.GetValue(result).ToString(), propertyValue.GetValue(dummy).ToString());
            Assert.Equal(fieldValue.GetValue(result).ToString(), fieldValue.GetValue(dummy).ToString());
        }
示例#2
0
        public void Serialize_Object_With_Private_Field_And_Property()
        {
            var dummy = new Dummy7(_fixture.Create <int>(), _fixture.Create <DateTime>());

            Check(() => XmlRepresentation.GetXml(dummy), dummy);
        }