Namespace: DeltaEngine.Content.Xml.Tests
Assembly: DeltaEngine.Content.Xml.Tests (in DeltaEngine.Content.Xml.Tests.dll) Version: 1.1.1.0 (1.1.1)
Assembly: DeltaEngine.Content.Xml.Tests (in DeltaEngine.Content.Xml.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Examples
[Test] public void GetDescendantWithAttribute() { XmlData root = CreateDeepTestXmlData(); Assert.AreEqual(root.Children[0], root.GetDescendant(new XmlAttribute("Attr1", "Value1"))); Assert.AreEqual(root.Children[1].Children[0], root.GetDescendant(new XmlAttribute("Attr5", "Value5"))); Assert.AreEqual(null, root.GetDescendant(new XmlAttribute("Attr5", "Value6"))); Assert.AreEqual(null, root.GetDescendant(new XmlAttribute("Attr6", "Value5"))); }
[Test] public void GetDescendantWithAttributeAndName() { XmlData root = CreateDeepTestXmlData(); Assert.AreEqual(root.Children[0], root.GetDescendant(new XmlAttribute("Attr1", "Value1"), root.Children[0].Name)); Assert.AreEqual(null, root.GetDescendant(new XmlAttribute("Attr1", "Value1"), root.Children[1].Name)); }
[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)); }
See Also