示例#1
0
        public void EqualHashDifferentKey()
        {
            KeyClass key1 = new KeyClass("a");
            KeyClass key2 = new KeyClass("b");

            DiskDictionary <KeyClass, int> dict = new DiskDictionary <KeyClass, int>();

            dict.Add(key1, 2);
            dict.Add(key2, 3);

            Assert.IsTrue(dict[key1] == 2);
            Assert.IsTrue(dict[key2] == 3);

            Assert.IsTrue(dict.Remove(key1));
            Assert.IsTrue(dict.Remove(key2));
        }
示例#2
0
        public void RemoveKey()
        {
            TestClass checkObject;
            // remove a key
            int key = COUNT / 2;

            Assert.IsTrue(_dict.Remove(key.ToString()));
            // should fail to retrive it
            Assert.IsFalse(_dict.TryGetValue(key.ToString(), out checkObject));
            _dict[key.ToString()] = new TestClass();
        }
        public void EqualHashDifferentKey()
        {
            KeyClass key1 = new KeyClass("a");
            KeyClass key2 = new KeyClass("b");

            DiskDictionary<KeyClass,int> dict = new DiskDictionary<KeyClass, int>();
            dict.Add(key1, 2);
            dict.Add(key2, 3);

            Assert.IsTrue( dict[key1] == 2 );
            Assert.IsTrue( dict[key2] == 3 );

            Assert.IsTrue(dict.Remove(key1));
            Assert.IsTrue(dict.Remove(key2));
        }