Пример #1
0
        public void FirstAvailable_LocationUnoccupied()
        {
            var  odDictionaryChild = new ODDictionaryChild <String, String>();
            bool keyAlreadyPresent;
            int  keyLocation = odDictionaryChild.FirstAvailable(5, "Key", out keyAlreadyPresent);

            Assert.IsFalse(keyAlreadyPresent);
            Assert.AreEqual(5, keyLocation);
        }
Пример #2
0
        public void GrowInnerArray_DeletedObjectsCleaned()
        {
            var odDictionaryChild = new ODDictionaryChild <String, String>();

            odDictionaryChild.InnerArray[5]           = new ODDictionaryNode <string, string>("Key", "Value");
            odDictionaryChild.InnerArray[6]           = new ODDictionaryNode <string, string>("Key1", "Value1");
            odDictionaryChild.InnerArray[7]           = new ODDictionaryNode <string, string>("Key2", "Value2");
            odDictionaryChild.InnerArray[7].IsDeleted = true;
            odDictionaryChild.GrowInnerArray();
            Assert.IsNull(odDictionaryChild.InnerArray.FirstOrDefault(filter => (filter != null && filter.Key.Equals("Key2"))));
        }
Пример #3
0
        public void FirstAvailable_AlreadyPresent()
        {
            var  odDictionaryChild = new ODDictionaryChild <String, String>();
            bool keyAlreadyPresent;

            odDictionaryChild.InnerArray[5] = new ODDictionaryNode <string, string>("Key", "Value");
            int keyLocation = odDictionaryChild.FirstAvailable(5, "Key", out keyAlreadyPresent);

            Assert.IsTrue(keyAlreadyPresent);
            Assert.AreEqual(5, keyLocation);
        }
Пример #4
0
        public void GrowInnerArray_NotDeletedObjectsStillPresent()
        {
            var odDictionaryChild = new ODDictionaryChild <String, String>();

            odDictionaryChild.InnerArray[5]           = new ODDictionaryNode <string, string>("Key", "Value");
            odDictionaryChild.InnerArray[6]           = new ODDictionaryNode <string, string>("Key1", "Value1");
            odDictionaryChild.InnerArray[7]           = new ODDictionaryNode <string, string>("Key2", "Value2");
            odDictionaryChild.InnerArray[7].IsDeleted = true;
            odDictionaryChild.GrowInnerArray();
            Assert.AreEqual("Value", odDictionaryChild["Key"]);
            Assert.AreEqual("Value1", odDictionaryChild["Key1"]);
        }
Пример #5
0
        public void FirstAvailable_LocationOccupiedWithDeletedSelfKey()
        {
            var  odDictionaryChild = new ODDictionaryChild <String, String>();
            bool keyAlreadyPresent;

            odDictionaryChild.InnerArray[5]           = new ODDictionaryNode <string, string>("Key", "Value");
            odDictionaryChild.InnerArray[5].IsDeleted = true;
            int keyLocation = odDictionaryChild.FirstAvailable(5, "Key", out keyAlreadyPresent);

            Assert.IsFalse(keyAlreadyPresent);
            Assert.AreEqual(5, keyLocation);
        }
Пример #6
0
        public void GrowInnerArray_SizeIncreased()
        {
            var odDictionaryChild = new ODDictionaryChild <String, String>();

            odDictionaryChild.InnerArray[5]           = new ODDictionaryNode <string, string>("Key", "Value");
            odDictionaryChild.InnerArray[6]           = new ODDictionaryNode <string, string>("Key1", "Value");
            odDictionaryChild.InnerArray[7]           = new ODDictionaryNode <string, string>("Key2", "Value2");
            odDictionaryChild.InnerArray[7].IsDeleted = true;
            int oldSize = odDictionaryChild.InnerArray.Length;

            odDictionaryChild.GrowInnerArray();
            Assert.IsTrue(odDictionaryChild.InnerArray.Length > oldSize);
        }
Пример #7
0
        public void GetIndexForKey_NullKey()
        {
            var odDictionaryChild = new ODDictionaryChild <String, String>();

            odDictionaryChild.GetIndexForKey(null);
        }