Example #1
0
        public void SearchThreeLevelCommandTest2()
        {
            var node     = new CommandNode();
            var command1 = new Command {
                Name = "show config"
            };
            var command2 = new Command {
                Name = "show"
            };

            node.Add(command1);
            node.Add(command2);

            List <CommandNode> cn1 = node.Search("show");

            Assert.IsNotNull(cn1);
            Assert.IsTrue(cn1.Count == 1);
            Assert.IsTrue(cn1.First().Name == "show");
            Assert.IsNotNull(cn1.First().Command);

            List <CommandNode> cn2 = node.Search("test");

            Assert.IsNotNull(cn2);
            Assert.IsTrue(cn2.Count == 0);

            List <CommandNode> cn3 = node.Search("sh");

            Assert.IsNotNull(cn3);
            Assert.IsTrue(cn3.First().Name == "show");
            Assert.IsNotNull(cn3.Count == 1);

            List <CommandNode> cn4 = node.Search("show c");

            Assert.IsNotNull(cn4);
            Assert.IsTrue(cn4.First().Name == "config");
            Assert.IsNotNull(cn3.Count == 1);
        }