Exemplo n.º 1
0
        public void TestGetResult_4()
        {
            var list = new List <MenuResponse> {
                GetNode1(), GetNode2(), GetNode3(), GetNode4()
            };
            var result = new MenuResult(list).GetResult();

            //根节点
            Assert.Equal(2, result.Count);
            var root = result.First();

            Assert.Equal(Id, root.Id);

            //根节点2
            var root2 = result[1];

            Assert.Equal(Id3, root2.Id);

            //子节点
            Assert.Equal(2, root.Children.Count);
            var child = root.Children[0];

            Assert.Equal(Id2, child.Id);

            //子节点2
            Assert.Equal(2, root.Children.Count);
            var child2 = root.Children[1];

            Assert.Equal(Id4, child2.Id);
        }
Exemplo n.º 2
0
        public void TestGetResult_3()
        {
            var list = new List <MenuResponse> {
                GetNode1(), GetNode2(), GetNode3()
            };
            var result = new MenuResult(list).GetResult();

            //根节点1
            Assert.Equal(2, result.Count);
            var root = result.First();

            Assert.Equal(Id, root.Id);
            Assert.Equal(Title, root.Text);

            //根节点2
            var root2 = result[1];

            Assert.Equal(Id3, root2.Id);
            Assert.Equal(Title3, root2.Text);
            Assert.Equal("a", root2.Icon);
            Assert.Equal("http://localhost/a/b", root2.ExternalLink);

            //子节点
            Assert.Single(root.Children);
            var child = root.Children[0];

            Assert.Equal(Id2, child.Id);
            Assert.Equal(Title2, child.Text);
        }
Exemplo n.º 3
0
        public void TestGetResult_1()
        {
            var list = new List <MenuResponse> {
                GetNode1()
            };
            var result = new MenuResult(list).GetResult();

            Assert.Single(result);
            var node = result.First();

            Assert.Equal(Id, node.Id);
            Assert.Equal(Title, node.Text);
            Assert.Equal("/a/b", node.Link);
        }
Exemplo n.º 4
0
        public void TestGetResult_2()
        {
            var list = new List <MenuResponse> {
                GetNode1(), GetNode2()
            };
            var result = new MenuResult(list).GetResult();

            //根节点
            Assert.Single(result);
            var root = result.First();

            Assert.Equal(Id, root.Id);
            Assert.Equal(Title, root.Text);

            //子节点
            Assert.Single(root.Children);
            var child = root.Children[0];

            Assert.Equal(Id2, child.Id);
            Assert.Equal(Title2, child.Text);
        }