Ejemplo n.º 1
0
 public void FailureWhenNotBinarySearchTree()
 {
     var vm = new BinaryTree();
     var list = BinaryTree.NodeList;
     for (var i = 0; i < 6; i++)
     {
         vm.AddBalancedNode(list[i]);
     }
     Assert.IsFalse(vm.IsThisBinaryTree());
 }
Ejemplo n.º 2
0
 public void SuccessWhenBinarySearchTree()
 {
     var vm = new BinaryTree();
     vm.AddDefaultTreeEntrance(null);
     Assert.IsTrue(vm.IsThisBinaryTree());
 }
Ejemplo n.º 3
0
 public void FailureWhenHeadRightChildLeftChildSmallerThanHead()
 {
     var vm = new BinaryTree();
     var headNode = new Node { Value = 2 };
     headNode.RightNode = new Node { Value = 3 };
     //this should be head.left
     headNode.RightNode.LeftNode = new Node { Value = 1 };
     vm.HeadNode = headNode;
     Assert.IsFalse(vm.IsThisBinaryTree());
 }