public void ToStringTest() { SimisTreeNode child1 = new SimisTreeNode("child1type", "child1name"); SimisTreeNode child2 = new SimisTreeNode("child2type", "child2name"); SimisTreeNode target = new SimisTreeNode("targettype", "targetname"); Assert.AreEqual("<targettype \"targetname\"></targettype>", target.ToString()); target = target.AppendChild(child1); Assert.AreEqual("<targettype \"targetname\"><child1type \"child1name\"></child1type></targettype>", target.ToString()); target = target.AppendChild(child2); Assert.AreEqual("<targettype \"targetname\"><child1type \"child1name\"></child1type>, <child2type \"child2name\"></child2type></targettype>", target.ToString()); }
public void AppendChildTest() { SimisTreeNode child1 = new SimisTreeNode("child1type", "child1name"); SimisTreeNode child2 = new SimisTreeNode("child2type", "child2name"); SimisTreeNode target = new SimisTreeNode("targettype", "targetname"); target = target.AppendChild(child1); Assert.AreEqual("targettype", target.Type); Assert.AreEqual("targetname", target.Name); Assert.AreEqual(1, target.Count); Assert.AreEqual(child1.Type, target[0].Type); Assert.AreEqual(child1.Name, target[0].Name); Assert.AreEqual(child1.Count, target[0].Count); target = target.AppendChild(child2); Assert.AreEqual("targettype", target.Type); Assert.AreEqual("targetname", target.Name); Assert.AreEqual(2, target.Count); Assert.AreEqual(child1.Type, target[0].Type); Assert.AreEqual(child1.Name, target[0].Name); Assert.AreEqual(child1.Count, target[0].Count); Assert.AreEqual(child2.Type, target[1].Type); Assert.AreEqual(child2.Name, target[1].Name); Assert.AreEqual(child2.Count, target[1].Count); }