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>")); }
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>")); }