public void TestRemove_ShouldRemoveElementIfExists(int element, int[] expectedResult) { _binaryTree.Remove(element); var result = new int[] { _binaryTree.Root.LeftChild.RightChild.Data, _binaryTree.Root.LeftChild.RightChild.RightChild.Data }; result.Should().BeEquivalentTo(expectedResult); }
static void BinaryTreeMain() { var tree = new DataStructures.BinaryTree.BinaryTree <int>(15); tree.Add(1); tree.Add(3); tree.Add(20); tree.Add(14); tree.Add(28); tree.Add(2); tree.Add(25); tree.Add(16); tree.Remove(3); tree.Remove(666); BinaryTree <int> .BFS(tree.Root, Console.WriteLine); DFS(tree.Root); }