private void IncorrectTreeLengthsTest(ISubtreeChecker subtreeChecker) { BinaryTreeNode t1 = CreateMainTree(); BinaryTreeNode t2 = CreateSubtree(); RunExceptionTest <ArgumentException>(t2, t1, subtreeChecker); }
private void RunTests(ISubtreeChecker subtreeChecker) { //NullTreeTest(subtreeChecker); //IncorrectTreeLengthsTest(subtreeChecker); IsSubtreeTest(subtreeChecker); IsNotSubtreeTest(subtreeChecker); }
private void IsNotSubtreeTest(ISubtreeChecker subtreeChecker) { BinaryTreeNode t1 = CreateMainTree(); BinaryTreeNode t2 = CreateNotSubtree(); bool result = subtreeChecker.IsSubtree(t1, t2); Assert.AreEqual(false, result); }
private void NullTreeTest(ISubtreeChecker subtreeChecker) { BinaryTreeNode t1 = new BinaryTreeNode(1); BinaryTreeNode t2 = null; RunExceptionTest <ArgumentException>(t1, t2, subtreeChecker); RunExceptionTest <ArgumentException>(t2, t1, subtreeChecker); }
private void RunExceptionTest <TException>(BinaryTreeNode t1, BinaryTreeNode t2, ISubtreeChecker subtreeChecker) where TException : Exception { try { subtreeChecker.IsSubtree(t1, t2); Assert.Fail(); } catch (TException) { } }