public void TestIsValidBinarySearchTree1() { // Arrange // Was just contemplating whether we need to call the method explicitly after we have marked it with TestInitialize Attribute // Turns Out :- No :-) // Act BinaryTreeOperations treeOperations = new BinaryTreeOperations(); var result = treeOperations.IsValidBinarySearchTree(root); // Assert Assert.AreEqual(true, result, "Wrong Value"); }
public void TestIsValidBinarySearchTree2() { // Arrange var root = new TreeNode(1); root.Left = new TreeNode(2); root.Left.Right = new TreeNode(5); root.Right = new TreeNode(3); // Act BinaryTreeOperations treeOperations = new BinaryTreeOperations(); var result = treeOperations.IsValidBinarySearchTree(root); // Assert Assert.AreEqual(false, result, "Wrong Value"); }