瀏覽代碼

Added test for TreeNode usage

tznind 4 年之前
父節點
當前提交
5dad1d2221
共有 1 個文件被更改,包括 15 次插入0 次删除
  1. 15 0
      UnitTests/TreeViewTests.cs

+ 15 - 0
UnitTests/TreeViewTests.cs

@@ -305,6 +305,21 @@ namespace UnitTests {
 			Assert.Empty(tree.GetChildren(c2));
 		}
 
+		[Fact]
+		public void TreeNode_WorksWithoutDelegate()
+		{
+			var tree = new TreeView();
+
+			var root = new TreeNode("Root");
+			root.Children.Add(new TreeNode("Leaf1"));
+			root.Children.Add(new TreeNode("Leaf2"));
+
+			tree.AddObject(root);
+
+			tree.Expand(root);
+			Assert.Equal(2,tree.GetChildren(root).Count());
+		}
+
 
 		/// <summary>
 		/// Simulates behind the scenes changes to an object (which children it has) and how to sync that into the tree using <see cref="TreeView.RefreshObject(object, bool)"/>