Namespace: DeltaEngine.Content.Xml
Assembly: DeltaEngine.Content.Xml (in DeltaEngine.Content.Xml.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Content.Xml.Tests.XmlDataTests
5 unit tests call DeltaEngine.Content.Xml.XmlData.Attributes
Assembly: DeltaEngine.Content.Xml (in DeltaEngine.Content.Xml.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Property Value
Type: List XmlAttributeRemarks
Examples
[Test] public void GetDescendantWithAttributes() { XmlData root = CreateDeepTestXmlData(); var attributes = new List<XmlAttribute> { new XmlAttribute("Attr1", "Value1"), new XmlAttribute("Attr2", "Value2") }; Assert.AreEqual(root.Children[0], root.GetDescendant(attributes)); Assert.AreEqual(root.Children[1].Children[0], root.GetDescendant(new List<XmlAttribute> { new XmlAttribute("Attr5", "Value5") })); attributes.Add(new XmlAttribute("Attr3", "Value3")); Assert.AreEqual(null, root.GetDescendant(attributes)); }
[Test] public void GetDescendantWithAttributesAndName() { XmlData root = CreateDeepTestXmlData(); var attributes = new List<XmlAttribute> { new XmlAttribute("Attr1", "Value1"), new XmlAttribute("Attr2", "Value2") }; Assert.AreEqual(root.Children[0], root.GetDescendant(attributes, "child1")); Assert.AreEqual(null, root.GetDescendant(attributes, "child2")); Assert.AreEqual(root.Children[1].Children[0], root.GetDescendant(new List<XmlAttribute> { new XmlAttribute("Attr5", "Value5") }), "child5"); }
[Test] public void GetAttributesAsDictionary() { XmlData root = CreateDeepTestXmlData(); var dict = root.Children[0].GetAttributesAsDictionary(); Assert.AreEqual(2, dict.Count); Assert.AreEqual("Value1", dict["Attr1"]); Assert.AreEqual("Value2", dict["Attr2"]); }
See Also