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
4 unit tests call DeltaEngine.Content.Xml.XmlData.AddChild(DeltaEngine.Content.Xml.XmlData)
Assembly: DeltaEngine.Content.Xml (in DeltaEngine.Content.Xml.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Parameters
- child
- Type: DeltaEngine.Content.Xml XmlData
Return Value
Type: XmlDataRemarks
Examples
[Test] public void GetChild() { var root = new XmlData("root"); root.AddChild(new XmlData("child1")); var child2 = new XmlData("child2"); root.AddChild(child2); Assert.AreEqual(child2, root.GetChild("child2")); }
[Test] public void GetChildren() { var root = new XmlData("root"); var child1 = new XmlData("child"); root.AddChild(child1); root.AddChild(new XmlData("stepchild")); var child2 = new XmlData("child"); root.AddChild(child2); var children = root.GetChildren("child"); Assert.AreEqual(2, children.Count); Assert.IsTrue(children.Contains(child1)); Assert.IsTrue(children.Contains(child2)); }
[Test] public void AddChildViaNameAndValueWillOnlyAddTheValueIfNotNull() { var node = new XmlData("Root"); Assert.IsNull(node.AddChild("Child").Value); Assert.IsNull(node.AddChild("Child", null).Value); Assert.IsEmpty(node.AddChild("Child", "").Value); Assert.AreEqual(4.ToString(), node.AddChild("Child", 4).Value); }
See Also