public void EnumeratorTest()
        {
            var tree = new BinaryTree<int>();
            var node0 = new BinaryTreeNode<int>(0);
            var node1 = new BinaryTreeNode<int>(1);
            var node2 = new BinaryTreeNode<int>(2);
            var node3 = new BinaryTreeNode<int>(3);
            var node4 = new BinaryTreeNode<int>(4);
            var node5 = new BinaryTreeNode<int>(5);
            var node6 = new BinaryTreeNode<int>(6);
            var node7 = new BinaryTreeNode<int>(7);
            var node8 = new BinaryTreeNode<int>(8);
            var node9 = new BinaryTreeNode<int>(9);
            var node10 = new BinaryTreeNode<int>(10);
            var node11 = new BinaryTreeNode<int>(11);
            var node12 = new BinaryTreeNode<int>(12);
            var node13 = new BinaryTreeNode<int>(13);
            var node14 = new BinaryTreeNode<int>(14);
            var node15 = new BinaryTreeNode<int>(15);
            var node16 = new BinaryTreeNode<int>(16);

            tree.Add(node8);
            tree.Add(node4);
            tree.Add(node12);
            tree.Add(node2);
            tree.Add(node6);
            tree.Add(node10);
            tree.Add(node14);
            tree.Add(node1);
            tree.Add(node3);
            tree.Add(node5);
            tree.Add(node7);
            tree.Add(node9);
            tree.Add(node11);
            tree.Add(node13);
            tree.Add(node15);
            tree.Add(node0);
            tree.Add(node16);

            // Structure:
            //                8
            //        4               12
            //    2       6      10        14
            //  1   3   5   7  9    11  13    15
            //0                                  16

            var list = tree.ToDepthFirstList();
            var index = 0;
            foreach (var item in tree)
            {
                Assert.AreEqual(list[index], item);
                index++;
            }

        }
        public void ToDepthFirstListTest()
        {
            var tree = new BinaryTree<int>();
            var node0 = new BinaryTreeNode<int>(0);
            var node1 = new BinaryTreeNode<int>(1);
            var node2 = new BinaryTreeNode<int>(2);
            var node3 = new BinaryTreeNode<int>(3);
            var node4 = new BinaryTreeNode<int>(4);
            var node5 = new BinaryTreeNode<int>(5);
            var node6 = new BinaryTreeNode<int>(6);
            var node7 = new BinaryTreeNode<int>(7);
            var node8 = new BinaryTreeNode<int>(8);
            var node9 = new BinaryTreeNode<int>(9);
            var node10 = new BinaryTreeNode<int>(10);
            var node11 = new BinaryTreeNode<int>(11);
            var node12 = new BinaryTreeNode<int>(12);
            var node13 = new BinaryTreeNode<int>(13);
            var node14 = new BinaryTreeNode<int>(14);
            var node15 = new BinaryTreeNode<int>(15);
            var node16 = new BinaryTreeNode<int>(16);

            tree.Add(node8);
            tree.Add(node4);
            tree.Add(node12);
            tree.Add(node2);
            tree.Add(node6);
            tree.Add(node10);
            tree.Add(node14);
            tree.Add(node1);
            tree.Add(node3);
            tree.Add(node5);
            tree.Add(node7);
            tree.Add(node9);
            tree.Add(node11);
            tree.Add(node13);
            tree.Add(node15);
            tree.Add(node0);
            tree.Add(node16);

            // Structure:
            //                8
            //        4               12
            //    2       6      10        14
            //  1   3   5   7  9    11  13    15
            //0                                  16

            var list = tree.ToDepthFirstList();

            for (var i = 0; i < list.Count - 1; i++)
            {
                Assert.IsTrue(list[i] < list[i + 1]);
            }
        }