示例#1
0
        public void TestIncludeAncestors()
        {
            var s = new XmSerializerModel();

            s.AddType(typeof(TestClass1));
            s.AddType(typeof(TestClass2));
            s.AddType(typeof(AncestorTestClass));
            var dto1    = new TestClass1();
            var dto2    = new TestClass2();
            var result1 = BasicTest.TestSerialization(dto1, s);
            var result2 = BasicTest.TestSerialization(dto2, s);

            Assert.AreEqual(dto1.GetBooFar(), result1.GetBooFar());
            Assert.AreEqual(dto2.GetBooFar(), result2.GetBooFar());
            Assert.AreEqual(dto1.GetFooBar(), result1.GetFooBar());
            Assert.IsNull(result2.GetFooBar());
        }