public void TheXmlElementAttributeDecoratingAListPropertyDefinedInInterfaceIsUsed() { var serializer = new XmlSerializer <HasListXmlElementAttribute>(x => x.ShouldUseAttributeDefinedInInterface()); var item = new HasListXmlElementAttribute { Bazes = new List <Baz> { new Baz { Qux = "abc" }, new Baz { Qux = "xyz" } } }; var xml = serializer.Serialize(item); Assert.That(xml, Is.Not.StringContaining("<Bazes>")); Assert.That(xml, Is.Not.StringContaining("<Baz>")); Assert.That(xml, Is.StringContaining("<Bar>")); }
public void TheXmlElementAttributeDecoratingAListPropertyDefinedInInterfaceIsUsed() { var serializer = new XmlSerializer<HasListXmlElementAttribute>(x => x.ShouldUseAttributeDefinedInInterface()); var item = new HasListXmlElementAttribute { Bazes = new List<Baz> { new Baz { Qux = "abc" }, new Baz { Qux = "xyz" } } }; var xml = serializer.Serialize(item); Assert.That(xml, Is.Not.StringContaining("<Bazes>")); Assert.That(xml, Is.Not.StringContaining("<Baz>")); Assert.That(xml, Is.StringContaining("<Bar>")); }