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 Add_InsertVertex_Fails()
        {
            #region data

            var idx = new BinaryTreeIndex();

            var vertexID = 1L;
            var propertyID = 1L;
            var fake_propertyID = 2L;
            var propertyValue = 10;
            // set propertyID for index
            idx.Init(new List<Int64>() { propertyID });

            // create a vertex
            var v = new InMemoryVertex(vertexID,
                1L,
                1L,
                null,
                null,
                null,
                "dummy",
                DateTime.Now.Ticks,
                DateTime.Now.Ticks,
                new Dictionary<long, IComparable>() { { fake_propertyID, propertyValue } }, // structured properties
                null);

            #endregion

            #region test

            // this won't add the vertex because it doesn't have the indexed property
            idx.Add(v);
            Assert.That(idx.KeyCount(), Is.EqualTo(0L), "vertex has been added by mistake");
            Assert.That(idx.ValueCount(), Is.EqualTo(0L), "vertex has been added by mistake");

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

            var idx = new BinaryTreeIndex();

            #endregion

            #region

            // init the index with some propertyIDs
            var definedPropertyIDs = new List<Int64>() { 0L, 1L };
            idx.Init(definedPropertyIDs);

            // use some reflection action to get the private member of the index instance
            var indexedPropertyIDs = (List<Int64>)idx.GetType().GetField("_PropertyIDs", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(idx);

            CollectionAssert.AreEqual(definedPropertyIDs, indexedPropertyIDs, "indexed propertyIDs do not match");

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

            var idx = new BinaryTreeIndex();

            var vertexID = 1L;
            var propertyID = 1L;
            var propertyValue = 10;
            // set propertyID for index
            idx.Init(new List<Int64>() { propertyID });

            // create a vertex
            var v = new InMemoryVertex(vertexID,
                1L,
                1L,
                null,
                null,
                null,
                "dummy",
                DateTime.Now.Ticks,
                DateTime.Now.Ticks,
                new Dictionary<long, IComparable>() { { propertyID, propertyValue } }, // structured properties
                null);

            #endregion

            #region test

            // add
            idx.Add(v);

            Assert.AreEqual(1, idx.KeyCount());
            Assert.AreEqual(1, idx.ValueCount());

            Assert.IsTrue(idx[propertyValue].Contains(vertexID));

            #endregion
        }