XmlDataTests GetDescendantWithAttributes Method Delta Engine Documentation

Namespace: DeltaEngine.Content.Xml.Tests
Assembly: DeltaEngine.Content.Xml.Tests (in DeltaEngine.Content.Xml.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void GetDescendantWithAttributes()
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");
}
See Also