public void ElementAtTest()
        {
            var tree = new RandomizedBinarySearchTree <int>();

            Assert.Throws <ArgumentOutOfRangeException>(() => tree.ElementAt(-1));
            Assert.Throws <ArgumentOutOfRangeException>(() => tree.ElementAt(1));

            tree.Insert(0);
            tree.Insert(1);
            tree.Insert(-1);
            tree.Insert(2);
            tree.Insert(-1);

            Assert.That(tree.ElementAt(0), Is.EqualTo(-1));
            Assert.That(tree.ElementAt(1), Is.EqualTo(-1));
            Assert.That(tree.ElementAt(2), Is.EqualTo(0));
            Assert.That(tree.ElementAt(3), Is.EqualTo(1));
            Assert.That(tree.ElementAt(4), Is.EqualTo(2));

            Assert.That(tree.Remove(0), Is.True);
            Assert.That(tree.ElementAt(0), Is.EqualTo(-1));
            Assert.That(tree.ElementAt(1), Is.EqualTo(-1));
            Assert.That(tree.ElementAt(2), Is.EqualTo(1));
            Assert.That(tree.ElementAt(3), Is.EqualTo(2));

            Assert.That(tree.Remove(-1), Is.True);
            Assert.That(tree.ElementAt(0), Is.EqualTo(-1));
            Assert.That(tree.ElementAt(1), Is.EqualTo(1));
            Assert.That(tree.ElementAt(2), Is.EqualTo(2));
        }
        public void RemoveTest()
        {
            var tree = new RandomizedBinarySearchTree <int>();

            tree.Insert(1);
            Assert.That(tree.Count, Is.EqualTo(1));

            Assert.That(tree.Remove(1), Is.True);
            Assert.That(tree.Count, Is.EqualTo(0));

            Assert.That(tree.Remove(0), Is.False);
            Assert.That(tree.Remove(1), Is.False);

            tree.Insert(1);
            tree.Insert(1);
            Assert.That(tree.Count, Is.EqualTo(2));

            Assert.That(tree.Remove(1), Is.True);
            Assert.That(tree.Count, Is.EqualTo(1));
        }