예제 #1
0
            public void ChangeWithClassPropertyDecoration()
            {
                var serializer = new XmlSerializer <OverridingBehavior>(x => x.ShouldUseAttributeDefinedInInterface());

                var item = new OverridingBehavior {
                    Foo = "abc"
                };

                var xml = serializer.Serialize(item);

                Assert.That(xml, Is.StringContaining("<Baz>abc</Baz>"));
                Assert.That(xml, Is.Not.StringContaining("<Foo>abc</Foo>"));
            }
예제 #2
0
            public void ChangeWithClassPropertyDecoration()
            {
                var serializer = new XmlSerializer<OverridingBehavior>(x => x.ShouldUseAttributeDefinedInInterface());

                var item = new OverridingBehavior { Foo = "abc" };

                var xml = serializer.Serialize(item);

                Assert.That(xml, Is.StringContaining("<Baz>abc</Baz>"));
                Assert.That(xml, Is.Not.StringContaining("<Foo>abc</Foo>"));
            }