Exemplo n.º 1
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() );
 }
Exemplo n.º 2
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() );
 }
 public string GetTree() {
     var node = new TreeNode { Id = "1", Text = "系统管理" };
     var node1 = new TreeNode { Id = "2", ParentId = "1", Text = "应用程序管理", Attributes = new { url = "/systems/application" } };
     var node2 = new TreeNode { Id = "3", ParentId = "1", Text = "租户管理", Attributes = new { url = "/systems/tenant" } };
     var node3 = new TreeNode { Id = "4", ParentId = "1", Text = "字典管理", Attributes = new { url = "/commons/dic" } };
     var node4 = new TreeNode { Id = "5", ParentId = "1", Text = "地区管理", Attributes = new { url = "/commons/area" } };
     var node123 = new TreeNode { Id = "123", ParentId = "1", Text = "系统配置管理2", Attributes = new { url = "/configs/systemconfig" } };
     var node5 = new TreeNode { Id = "6", ParentId = "1", Text = "用户管理", Attributes = new { url = "/systems/user" } };
     var node6 = new TreeNode { Id = "7", ParentId = "1", Text = "角色管理", Attributes = new { url = "/systems/role" } };
     var node7 = new TreeNode { Id = "8", ParentId = "1", Text = "资源管理", Attributes = new { url = "/systems/resource" } };
     var node8 = new TreeNode { Id = "9", ParentId = "1", Text = "图标管理", Attributes = new { url = "/commons/icon" } };
     var node9 = new TreeNode { Id = "10", ParentId = "1", Text = "站点管理", Attributes = new { url = "/systems/site" } };
     var node20 = new TreeNode { Id = "20", ParentId = "1", Text = "测试", Attributes = new { url = "/Desktop" } };
     return new TreeResult( new[] { node, node1, node123, node2, node3, node4, node5, node6, node7, node8, node9, node20 } ).ToString();
 }
Exemplo 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() );
 }
Exemplo n.º 5
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() );
 }
Exemplo n.º 6
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() );
 }