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()); }
public void SuccessWhenBinarySearchTree() { var vm = new BinaryTree(); vm.AddDefaultTreeEntrance(null); Assert.IsTrue(vm.IsThisBinaryTree()); }
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()); }