Exemple #1
0
        public void Should_add_another_child()
        {
            var rootNode = new Node("/");
            rootNode.AddPath("/home/sports/");
            rootNode.AddPath("/home/music/");

            var anotherChild = rootNode.GetChildren()[0].GetChildren()[1];

            Assert.That(anotherChild.ToString(), Is.EqualTo("music"));
        }
Exemple #2
0
        public void Should_add_many_children_and_grand_children()
        {
            var rootNode = new Node("/");
            rootNode.AddPath("/home/sports/basketball");
            rootNode.AddPath("/home/sports/football");
            rootNode.AddPath("/home/sports/basketball/NCAA");

            rootNode.AddPath("/home/music/");
            rootNode.AddPath("/home/music/rap");
            rootNode.AddPath("/home/music/rock");
            rootNode.AddPath("/home/music/rap/gangster");

            Assert.That(rootNode.GetChildren()[0].GetChildren()[0].ToString(), Is.EqualTo("sports"));
            Assert.That(rootNode.GetChildren()[0].GetChildren()[0].GetChildren()[0].ToString(), Is.EqualTo("basketball"));
            Assert.That(rootNode.GetChildren()[0].GetChildren()[0].GetChildren()[1].ToString(), Is.EqualTo("football"));
            Assert.That(rootNode.GetChildren()[0].GetChildren()[0].GetChildren()[0].GetChildren()[0].ToString(), Is.EqualTo("NCAA"));

            Assert.That(rootNode.GetChildren()[0].GetChildren()[1].ToString(), Is.EqualTo("music"));
            Assert.That(rootNode.GetChildren()[0].GetChildren()[1].GetChildren()[0].ToString(), Is.EqualTo("rap"));
            Assert.That(rootNode.GetChildren()[0].GetChildren()[1].GetChildren()[1].ToString(), Is.EqualTo("rock"));
            Assert.That(rootNode.GetChildren()[0].GetChildren()[1].GetChildren()[0].GetChildren()[0].ToString(), Is.EqualTo("gangster"));
        }
Exemple #3
0
        public void Should_support_dual_leaf_nodes()
        {
            var rootNode = new Node("/");
            rootNode.AddPath("/home/sports/basketball");
            rootNode.AddPath("/home/sports/football");
            rootNode.AddPath("/home/sports/basketball/NCAA");
            rootNode.AddPath("/home/sports/football/NFL|NCAA");

            Assert.That(rootNode.GetChildren()[0].FindNode("sports"), Is.Not.Null);
            Assert.That(rootNode.GetChildren()[0].GetChildren()[0].FindNode("basketball"), Is.Not.Null);
            Assert.That(rootNode.GetChildren()[0].GetChildren()[0].FindNode("football"), Is.Not.Null);
            Assert.That(rootNode.GetChildren()[0].GetChildren()[0].GetChildren()[1].FindNode("NFL"), Is.Not.Null);
            Assert.That(rootNode.GetChildren()[0].GetChildren()[0].GetChildren()[1].FindNode("NCAA"), Is.Not.Null);
        }
Exemple #4
0
        public void Should_support_combinatorial_leaf_node_insert()
        {
            var rootNode = new Node("/");
            rootNode.AddPath("/home/music/rap|rock|pop");

            AssertNodeExists(rootNode.GetChildren()[0].GetChildren()[0], "rap");
            AssertNodeExists(rootNode.GetChildren()[0].GetChildren()[0], "rock");
            AssertNodeExists(rootNode.GetChildren()[0].GetChildren()[0], "pop");
            AssertNodeExists(rootNode.GetChildren()[0].GetChildren()[0], "rap-rock");
            AssertNodeExists(rootNode.GetChildren()[0].GetChildren()[0], "rap-pop");
            AssertNodeExists(rootNode.GetChildren()[0].GetChildren()[0], "rock-pop");
            AssertNodeExists(rootNode.GetChildren()[0].GetChildren()[0], "rap-rock-pop");
        }