public void Contains_6_True() { bool containsResult = false; GenericBinaryTree<TestObject_Integer> testTree = new GenericBinaryTree<TestObject_Integer>(); testTree.Add(new TestObject_Integer(4)); testTree.Add(new TestObject_Integer(2)); testTree.Add(new TestObject_Integer(6)); testTree.Add(new TestObject_Integer(1)); testTree.Add(new TestObject_Integer(3)); testTree.Add(new TestObject_Integer(5)); testTree.Add(new TestObject_Integer(7)); containsResult = testTree.Contains(new TestObject_Integer(6)); Assert.IsTrue(containsResult, "ContainsResult"); Assert.IsFalse(testTree.IsEmpty, "IsEmpty"); Assert.IsFalse(testTree.HasErrors, "HasErrors"); Assert.IsNotNull(testTree.ParentNode, "ParentNode"); Assert.IsNotNull(testTree.CurrentNode, "CurrentNode"); Assert.IsNotNull(testTree.LeftGrandChild, "LeftGrandChild"); Assert.IsNotNull(testTree.RightGrandChild, "RightGrandChild"); Assert.AreEqual(4, testTree.ParentNode.Item.Value); Assert.AreEqual(6, testTree.CurrentNode.Item.Value); Assert.AreEqual(5, testTree.LeftGrandChild.Item.Value); Assert.AreEqual(7, testTree.RightGrandChild.Item.Value); }
public void Contains_null() { bool containsResult = true; GenericBinaryTree<TestObject_Integer> testTree = new GenericBinaryTree<TestObject_Integer>(); containsResult = testTree.Contains(null); Assert.IsFalse(containsResult, "ContainsResult"); Assert.IsTrue(testTree.IsEmpty, "IsEmpty"); Assert.IsTrue(testTree.HasErrors, "HasErrors"); Assert.IsNull(testTree.RootNode, "RootNode"); Assert.IsNull(testTree.ParentNode, "ParentNode"); Assert.IsNull(testTree.CurrentNode, "CurrentNode"); Assert.IsNull(testTree.LeftGrandChild, "LeftGrandChild"); Assert.IsNull(testTree.RightGrandChild, "RightGrandChild"); }