Ejemplo n.º 1
0
        public void Test_Async_State()
        {
            var node = new TreeNode {
                Id = "1", Text = "a"
            };

            _result = new TreeResult(new[] { node }, true);
            Assert.AreEqual("[{\"id\":\"1\",\"text\":\"a\",\"state\":\"closed\"}]", _result.ToString());
        }
Ejemplo n.º 2
0
        public void Test_2Node_Children()
        {
            var node = new TreeNode {
                Id = "1", Text = "a", Level = 1
            };
            var node2 = new TreeNode {
                Id = "2", ParentId = "1", Text = "b", Level = 2
            };

            _result = new TreeResult(new[] { node, node2 });
            var expected = new Str();

            expected.Add("[{\"id\":\"1\",\"text\":\"a\",");
            expected.Add("\"children\":[{\"id\":\"2\",\"ParentId\":\"1\",\"text\":\"b\"}]");
            expected.Add("}]");
            Assert.AreEqual(expected.ToString(), _result.ToString());
        }
Ejemplo n.º 3
0
        public void Test_3Node_Children()
        {
            var node = new TreeNode {
                Id = "1"
            };
            var node2 = new TreeNode {
                Id = "2", ParentId = "1"
            };
            var node3 = new TreeNode {
                Id = "3", ParentId = "2"
            };

            _result = new TreeResult(new[] { node2, node3, node });
            var expected = new Str();

            expected.Add("[{\"id\":\"1\",\"children\":[");
            expected.Add("{\"id\":\"2\",\"ParentId\":\"1\",\"children\":[");
            expected.Add("{\"id\":\"3\",\"ParentId\":\"2\"}]");
            expected.Add("}]}]");
            Assert.AreEqual(expected.ToString(), _result.ToString());
        }
Ejemplo n.º 4
0
        public void Test_2Node()
        {
            var node = new TreeNode {
                Id = "1", Text = "a"
            };
            var node2 = new TreeNode {
                Id = "2", Text = "b"
            };

            _result = new TreeResult(new[] { node, node2 });
            Assert.AreEqual("[{\"id\":\"1\",\"text\":\"a\"},{\"id\":\"2\",\"text\":\"b\"}]", _result.ToString());
        }
Ejemplo n.º 5
0
        public void Test_1Node()
        {
            var node = new TreeNode {
                Id = "1", Text = "a", Attributes = new { url = "b" }
            };

            _result = new TreeResult(new[] { node });
            Assert.AreEqual("[{\"id\":\"1\",\"text\":\"a\",\"attributes\":{\"url\":\"b\"}}]", _result.ToString());
        }
Ejemplo n.º 6
0
 public void TestNull()
 {
     _result = new TreeResult(null);
     Assert.AreEqual("[]", _result.ToString());
 }