public void Add_NewStudentNodeToPrevious_ShouldPutNewNodeToRightSideOfPrevious() { //act nodeStudent_10.Add(nodeStudent_20); //assert Assert.AreEqual(nodeStudent_10.LeftNode, null); Assert.AreEqual(nodeStudent_10.RightNode, nodeStudent_20); }
public void GetDataByForeach_BinaryTree_10_4_12_Return_4_10_12() { //arrange BinaryTreeNode <int> binaryTree = new BinaryTreeNode <int>(10); binaryTree.Add(new BinaryTreeNode <int>(4)); binaryTree.Add(new BinaryTreeNode <int>(12)); // act string result = string.Empty; foreach (int item in binaryTree) { result += item; } //assert Assert.AreEqual(result, "41012"); }
public void Add_NewIntNodeToPrevious_ShouldPutNewNodeToRightSideOfPrevious() { //arrange BinaryTreeNode <int> binaryTree = new BinaryTreeNode <int>(10); BinaryTreeNode <int> node = new BinaryTreeNode <int>(20); // act binaryTree.Add(node); //assert Assert.AreEqual(binaryTree.LeftNode, null); Assert.AreEqual(binaryTree.RightNode, node); }