Browse Source

Added test for TreeNode usage

tznind 4 years ago
parent
commit
5dad1d2221
1 changed files with 15 additions and 0 deletions
  1. 15 0
      UnitTests/TreeViewTests.cs

+ 15 - 0
UnitTests/TreeViewTests.cs

@@ -305,6 +305,21 @@ namespace UnitTests {
 			Assert.Empty(tree.GetChildren(c2));
 			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>
 		/// <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)"/>
 		/// 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)"/>