public void TestCreateIndex()
        {
            IValueExtractor extractor = new IdentityExtractor();
            IFilter         filter    = new GreaterFilter(extractor, 5);
            IDictionary     map       = new HashDictionary();

            var condExtractor = new ConditionalExtractor(filter, extractor, true);

            var index = condExtractor.CreateIndex(false, null, map);

            Assert.IsTrue(index is ConditionalIndex);
            Assert.AreEqual(filter, ((ConditionalIndex)index).Filter);
            Assert.AreEqual(extractor, index.ValueExtractor);

            // make sure that the index map has been updated with the created
            // index
            var index2 = map[extractor] as ICacheIndex;

            Assert.IsNotNull(index2);
            Assert.AreEqual(index, index2);
        }
        public void testCoh5516()
        {
            IFilter         typeFilter    = new EqualsFilter("getType", "bird");
            IValueExtractor intExtractor  = new ReflectionExtractor("getWings");
            var             condExtractor = new ConditionalExtractor(typeFilter, intExtractor, false);
            IDictionary     map           = new HashDictionary();

            var index = condExtractor.CreateIndex(false, null, map);

            var bird   = new Bird();
            var fish   = new Fish();
            var entry1 = new CacheEntry(0, bird, bird);
            var entry2 = new CacheEntry(1, fish, fish);

            // add entries of type Fish and Bird - only the Bird should get indexed
            index.Insert(entry1);
            index.Insert(entry2);

            // remove entries of type Fish and Bird - only the Bird should get indexed
            index.Delete(entry1);
            index.Delete(entry2);
        }
        public void TestDestroyIndex()
        {
            IValueExtractor extractor = new IdentityExtractor();
            IFilter         filter    = new GreaterFilter(extractor, 5);
            IDictionary     map       = new HashDictionary();

            var condExtractor = new ConditionalExtractor(filter, extractor, true);

            var index = condExtractor.CreateIndex(false, null, map);

            // make sure that the index map has been updated with the created
            // index
            var index2 = map[extractor] as ICacheIndex;

            Assert.IsNotNull(index2);
            Assert.AreEqual(index, index2);

            condExtractor.DestroyIndex(map);

            // make sure that the index has been removed from the index map
            Assert.IsNull(map[extractor]);
        }