Beispiel #1
0
            public void IgnoreWithExplicitImplementation()
            {
                var serializer = new XmlSerializer <RemovingBehavior>(x => x.ShouldUseAttributeDefinedInInterface());

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

                var xml = serializer.Serialize(item);

                Assert.That(xml, Is.StringContaining("<Foo>abc</Foo>"));
                Assert.That(xml, Is.Not.StringContaining("<Bar>abc</Bar>"));
            }
            public void IgnoreWithExplicitImplementation()
            {
                var serializer = new XmlSerializer<RemovingBehavior>(x => x.ShouldUseAttributeDefinedInInterface());

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

                var xml = serializer.Serialize(item);

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