Ejemplo n.º 1
0
        public void HasChildTest()
        {
            var tree = new TreeNodeBase <int> {
                Id = 1
            };
            var child = new TreeNodeBase <int> {
                Id = 2
            };


            tree.AddChild(child);


            Assert.IsFalse(child.HasChild);
            Assert.IsTrue(tree.HasChild);
        }
Ejemplo n.º 2
0
        public void IsParentTest()
        {
            var tree = new TreeNodeBase <int> {
                Id = 1
            };
            var middle = new TreeNodeBase <int> {
                Id = 3
            };
            var child = new TreeNodeBase <int> {
                Id = 2
            };


            tree.AddChild(middle);
            middle.AddChild(child);


            Assert.IsTrue(child.IsParent(tree));
            Assert.IsFalse(child.IsParent(child));
            Assert.IsFalse(tree.IsParent(tree));
        }