Пример #1
0
        public void TestParameters()
        {
            RootEntry root = OutputParser.parse(@"a|color=#ff0");

            Assert.AreEqual(1, root.children.Count);
            Assert.AreEqual("#ff0", root.children[0].color);
        }
Пример #2
0
        public void TestSingleLine()
        {
            RootEntry root = OutputParser.parse("hello");

            Assert.AreEqual(root.children.Count, 1);
            Assert.AreEqual(root.menu.Count, 0);
            Assert.AreEqual(root.children[0].text, "hello");
        }
Пример #3
0
        public void TestTwoLinesInRoot()
        {
            RootEntry root = OutputParser.parse(@"hello
there");

            Assert.AreEqual(root.children.Count, 2);
            Assert.AreEqual(root.menu.Count, 0);
            Assert.AreEqual(root.children[0].text, "hello");
            Assert.AreEqual(root.children[1].text, "there");
        }
Пример #4
0
        public void TestOneContext()
        {
            RootEntry root = OutputParser.parse(@"hello
---
there");

            Assert.AreEqual(root.children.Count, 1);
            Assert.AreEqual(root.menu.Count, 1);
            Assert.AreEqual(root.children[0].text, "hello");
            Assert.AreEqual(root.menu[0].text, "there");
        }
Пример #5
0
        public void TestNested()
        {
            RootEntry root = OutputParser.parse(@"a
---
b
--c
----d");

            Assert.AreEqual(root.children.Count, 1);
            Assert.AreEqual(root.menu.Count, 1);
            Assert.AreEqual(root.menu[0].children.Count, 1);
            Assert.AreEqual(root.menu[0].children[0].children.Count, 1);
        }
Пример #6
0
        public void TestFull()
        {
            RootEntry root = OutputParser.parse(@"a
---
b
---
c
--d
-----
--e
--f");

            Assert.AreEqual(root.children.Count, 1);
            Assert.AreEqual(3, root.menu.Count);
        }
Пример #7
0
        public void TestSubmenuSeparator()
        {
            RootEntry root = OutputParser.parse(@"hello
---
there
--b
-----
--c");

            Assert.AreEqual(root.children.Count, 1);
            Assert.AreEqual(root.menu.Count, 1);
            Assert.AreEqual(root.children[0].text, "hello");
            Assert.AreEqual(root.menu[0].text, "there");
            Assert.AreEqual(root.menu[0].children[0].text, "b");
            Assert.AreEqual(root.menu[0].children[1].isSeparator, true);
        }
Пример #8
0
        public void TestNestedDifferentLevels()
        {
            RootEntry root = OutputParser.parse(@"a
---
b
--c
----d
----e
------f
------g
--h
----l");

            Assert.AreEqual(1, root.children.Count);
            Assert.AreEqual(1, root.menu.Count);
            Assert.AreEqual(2, root.menu[0].children.Count);
            Assert.AreEqual(2, root.menu[0].children[0].children.Count);
            Assert.AreEqual(2, root.menu[0].children[0].children[1].children.Count);
            Assert.AreEqual(1, root.menu[0].children[1].children.Count);
        }