/// <summary> /// Test removing a branch node from the tree /// </summary> static void TestRemoveBranchNode() { Tree <int> tree = new Tree <int>(4); TreeNode <int> node5 = new TreeNode <int>(5, tree.Root); tree.AddNode(node5); TreeNode <int> node6 = new TreeNode <int>(6, node5); tree.AddNode(node6); TreeNode <int> node7 = new TreeNode <int>(7, node5); tree.AddNode(node7); TreeNode <int> node8 = new TreeNode <int>(8, node6); tree.AddNode(node8); bool success = tree.RemoveNode(node5); Console.Write("TestRemoveBranchNode: "); string treeString = tree.ToString(); if (treeString.Equals("Root: 4 [Node Value: 4 Parent: null Children: ]") && tree.Count == 1 && success) { Console.WriteLine("Passed"); } else { Console.WriteLine("FAILED!!! Expected: " + "Root: 4 [Node Value: 4 Children: 5 ], " + "2, and true Actual: " + treeString + ", " + tree.Count + " and " + success); } }