Ejemplo n.º 1
0
        public void SerializeToXml_Subclass()
        {
            var orig = new ClassWithSubclass {
                element = new SimpleClass {
                    a = 1, b = 2
                }
            };
            var copy = SerializeDeserialize <ClassWithSubclass>(orig);

            Assert.AreEqual(orig.element.a, copy.element.a);
            Assert.AreEqual(orig.element.b, copy.element.b);
        }
Ejemplo n.º 2
0
        public void SubclassesWork()
        {
            ClassWithSubclass outer = new ClassWithSubclass()
            {
                IntWithinSuperclass = 5,
                SubclassInstance1   = new ClassWithSubclass.SubclassWithinClass()
                {
                    StringWithinSubclass = "within1"
                },
                SubclassInstance2 = new ClassWithSubclass.SubclassWithinClass()
                {
                    StringWithinSubclass = "within2"
                }
            };
            var clone = outer.CloneLazinatorTyped();

            clone.IntWithinSuperclass.Should().Be(5);
            clone.SubclassInstance1.StringWithinSubclass.Should().Be("within1");
            clone.SubclassInstance2.StringWithinSubclass.Should().Be("within2");
        }