public void Xml2IBFTest1Level2(string xml, string country, string city, string county1, string county2) { IBNode ibNode = IBFormat.ConvertXml2IBF(xml); Assert.IsTrue(ibNode.IsRoot()); Assert.AreEqual(1, ibNode.GetChildNodes().Count); Assert.AreEqual("Country", ibNode.GetName()); Assert.AreEqual(country, ibNode.GetValue()); IBNode childNode = ibNode.GetChildNodes()[0]; Assert.AreEqual(2, childNode.GetChildNodes().Count); Assert.AreEqual("City", childNode.GetName()); Assert.AreEqual(city, childNode.GetValue()); IBNode grandChild1 = childNode.GetChildNodes()[0]; Assert.AreEqual(0, grandChild1.GetChildNodes().Count); Assert.AreEqual("County", grandChild1.GetName()); Assert.AreEqual(county1, grandChild1.GetValue()); IBNode grandChild2 = childNode.GetChildNodes()[1]; Assert.AreEqual(0, grandChild2.GetChildNodes().Count); Assert.AreEqual("County", grandChild2.GetName()); Assert.AreEqual(county2, grandChild2.GetValue()); }
public void Xml2IBFTest1Level(string xml, object value) { IBNode ibNode = IBFormat.ConvertXml2IBF(xml); Assert.IsTrue(ibNode.IsRoot()); Assert.AreEqual(value, ibNode.Value); Assert.AreEqual("sample", ibNode.GetName()); Assert.AreEqual(0, ibNode.GetChildNodes().Count); }
public void AddChild(string childName, object childValue, string parentName, object parentValue) { IBNode parentNode = new IBNode(parentName, parentValue, null); IBNode childNode = new IBNode(childName, childValue, parentNode); List <IBNode> nodes = parentNode.GetChildNodes(); Assert.AreEqual(1, nodes.Count); Assert.AreEqual(childNode, nodes[0]); }
public void AddLevel3Child(string name1, object value1, string name2, object value2, string name3, object value3) { IBNode node1 = new IBNode(name1, value1, null); IBNode node2 = new IBNode(name2, value2, node1); IBNode node3 = new IBNode(name3, value3, node2); List <IBNode> nodes1 = node1.GetChildNodes(); List <IBNode> nodes2 = node2.GetChildNodes(); Assert.AreEqual(1, nodes1.Count); Assert.AreEqual(1, nodes2.Count); Assert.AreEqual(node2, nodes1[0]); Assert.AreEqual(node3, nodes2[0]); }
public void CheckChildrenAfterInitialization(string child1Name, object child1Value, string child2Name, object child2Value, string parentName, object parentValue) { IBNode parentNode = new IBNode(parentName, parentValue, null); Assert.AreEqual(0, parentNode.GetChildNodes().Count); }