示例#1
0
        public void TestClassGenericThree()
        {
            var obj = new TestClassGenericThree <string, int, TestClassPrimitiveTypes>();

            obj.Init("StringValue", 1, new TestClassPrimitiveTypes());
            obj.GenericProp3.Init();

            CheckSerializationAndDeserialization("ExtendedXmlSerializerTest.Resources.TestClassGenericThree.xml", obj);
            CheckCompatibilityWithDefaultSerializator(obj);
        }
示例#2
0
        public void TestClassPropGeneric()
        {
            var pop = new TestClassGenericThree <string, int, decimal>();

            pop.Init("StringValue", 1, 4.4m);
            var obj = new TestClassPropGeneric();

            obj.PropGenric = pop;


            CheckSerializationAndDeserialization("ExtendedXmlSerializerTest.Resources.TestClassPropGeneric.xml", obj);
            CheckCompatibilityWithDefaultSerializator(obj);
        }
        public void Generic()
        {
            var expected = new TestClassGenericThree <string, int, TestClassPrimitiveTypes>();

            expected.Init("StringValue", 1, TestClassPrimitiveTypes.Create());

            var data   = _serializer.Serialize(expected);
            var actual = _serializer.Deserialize <TestClassGenericThree <string, int, TestClassPrimitiveTypes> >(data);

            Assert.NotNull(actual);
            Assert.Equal(expected.GenericProp, actual.GenericProp);
            Assert.Equal(expected.GenericProp2, actual.GenericProp2);
            Assert.Equal(expected.GenericProp3.PropDateTime, actual.GenericProp3.PropDateTime);
            Assert.Equal(data, _serializer.Serialize(actual));
        }
        public void GenericProperty()
        {
            var obj = new TestClassGenericThree <string, int, decimal>();

            obj.Init("StringValue", 1, 123.1m);

            var expected = new TestClassPropGeneric()
            {
                PropGenric = obj
            };

            var data   = _serializer.Serialize(expected);
            var actual = _serializer.Deserialize <TestClassPropGeneric>(data);

            Assert.NotNull(actual);
            Assert.Equal(obj.GenericProp, actual.PropGenric.GenericProp);
            Assert.Equal(obj.GenericProp2, actual.PropGenric.GenericProp2);
            Assert.Equal(obj.GenericProp3, actual.PropGenric.GenericProp3);
            Assert.Equal(data, _serializer.Serialize(actual));
        }