Example #1
0
        public void NodePathConstructorFromNodeTest()
        {
            Node root  = new Node("Type", "Root");
            Node node1 = root.AddChild(new Node("Type", "Node1"));
            Node node2 = node1.AddChild(new Node("Type", "Node2"));
            Node node3 = node2.AddChild(new Node("Type", "Node3"));

            NodePath nodePath = new NodePath(node3);

            Assert.AreEqual(nodePath.Path, "Root/Node1/Node2/Node3");
            Assert.AreEqual(nodePath.ParentPath, "Root/Node1/Node2");
            Assert.AreEqual(nodePath.Sections.Count, 4);
            Assert.AreEqual(nodePath.Sections[0], "Root");
            Assert.AreEqual(nodePath.Sections[1], "Node1");
            Assert.AreEqual(nodePath.Sections[2], "Node2");
            Assert.AreEqual(nodePath.Sections[3], "Node3");
        }