public virtual void AddRange_InsertKeyValuePairs()
        {
            #region data

            var idx = new BinaryTreeIndex();

            var n = 10;
            var vertices = CreateKeyValuePairs(n);

            #endregion

            #region test

            idx.AddRange(vertices);

            // check counts
            Assert.That(idx.KeyCount(), Is.EqualTo(n));
            Assert.That(idx.KeyCount(), Is.EqualTo(n));

            // check propertyIDs
            for (long vID = 0; vID < n; vID++)
            {
                Assert.IsTrue(idx.ContainsKey(vID));
                Assert.IsTrue(idx[vID].Contains(vID));
                Assert.That(idx[vID].LongCount(), Is.EqualTo(1L));
            }

            #endregion
        }
        public void ValueCountTest()
        {
            #region data

            var idx = new BinaryTreeIndex();

            var kvp = new List<KeyValuePair<IComparable, Int64>>()
            {
                new KeyValuePair<IComparable, Int64>(1, 1),
                new KeyValuePair<IComparable, Int64>(1, 2),
                new KeyValuePair<IComparable, Int64>(2, 3),
                new KeyValuePair<IComparable, Int64>(2, 4),
                new KeyValuePair<IComparable, Int64>(2, 5),
            };

            idx.AddRange(kvp, IndexAddStrategy.MERGE);

            #endregion

            #region test

            Assert.That(idx.ValueCount(), Is.EqualTo(5));

            #endregion
        }
        public virtual void AddRange_InsertVertices()
        {
            #region data

            var idx = new BinaryTreeIndex();

            var n = 10;
            var propertyID = 1L;
            var vertices = CreateVertices(n, propertyID);

            idx.Init(new List<Int64>() { propertyID });

            #endregion

            #region Test

            idx.AddRange(vertices);

            // check counts
            Assert.That(idx.KeyCount(), Is.EqualTo(n));
            Assert.That(idx.KeyCount(), Is.EqualTo(n));

            // check propertyIDs
            for (long vID = 0; vID < n; vID++)
            {
                Assert.IsTrue(idx.ContainsKey(vID));
                Assert.IsTrue(idx[vID].Contains(vID));
                Assert.That(idx[vID].LongCount(), Is.EqualTo(1L));
            }

            #endregion
        }
        public virtual void RemoveRange_RemoveVertices()
        {
            #region data

            var n = 10;
            var propertyID = 1L;
            var idx = new BinaryTreeIndex();
            var vertices = CreateVertices(n, propertyID);

            idx.Init(new List<Int64>() { propertyID });

            #endregion

            #region test

            idx.AddRange(vertices);

            Assert.That(idx.KeyCount(), Is.EqualTo(n));
            Assert.That(idx.ValueCount(), Is.EqualTo(n));

            idx.RemoveRange(vertices);

            Assert.That(idx.KeyCount(), Is.EqualTo(0));
            Assert.That(idx.ValueCount(), Is.EqualTo(0));

            #endregion
        }
        public virtual void RemoveRange_RemoveKeys()
        {
            #region data

            var n = 10;
            var idx = new BinaryTreeIndex();
            var vertices = CreateKeyValuePairs(n);

            #endregion

            #region test

            idx.AddRange(vertices);

            Assert.That(idx.KeyCount(), Is.EqualTo(n));
            Assert.That(idx.ValueCount(), Is.EqualTo(n));

            idx.RemoveRange(vertices.Select(kvp => kvp.Key));

            Assert.That(idx.KeyCount(), Is.EqualTo(0));
            Assert.That(idx.ValueCount(), Is.EqualTo(0));

            #endregion
        }
        public virtual void Keys()
        {
            #region data

            var idx = new BinaryTreeIndex();

            var n = 10;
            var vertices = CreateKeyValuePairs(n);

            #endregion

            #region test

            idx.AddRange(vertices);

            var keys = idx.Keys();

            Assert.That(keys.LongCount(), Is.EqualTo(n));

            for (long i = 0; i < n; i++)
            {
                CollectionAssert.Contains(keys, i);
            }

            #endregion
        }