public void TestComparableMinAggregator()
        {
            ComparableMin agg1 = new ComparableMin(IdentityExtractor.Instance);

            Assert.IsNotNull(agg1);
            Assert.AreSame(IdentityExtractor.Instance, agg1.Extractor);

            ComparableMin agg2 = new ComparableMin("dummy");

            Assert.IsNotNull(agg2);
            Assert.IsInstanceOf(typeof(ReflectionExtractor), agg2.Extractor);

            ComparableMin agg3 = new ComparableMin("another.dummy");

            Assert.IsNotNull(agg3);
            Assert.IsInstanceOf(typeof(ChainedExtractor), agg3.Extractor);

            ArrayList al = new ArrayList();

            al.Add(new TestInvocableCacheEntry("Ivan", 173));
            al.Add(new TestInvocableCacheEntry("Goran", 185));
            al.Add(new TestInvocableCacheEntry("Ana", 164));
            Assert.AreEqual(164, agg1.Aggregate(al));

            string[] array = new string[] { "Ana", "Ivan", "Goran" };
            Assert.AreEqual("Ana", agg1.AggregateResults(array));

            // aggragation on remote cache
            INamedCache cache = CacheFactory.GetCache(CacheName);

            cache.Clear();

            Hashtable ht = new Hashtable();

            ht.Add("comparableMinKey1", 435);
            ht.Add("comparableMinKey2", 253);
            ht.Add("comparableMinKey3", 3);
            ht.Add("comparableMinKey4", null);
            ht.Add("comparableMinKey5", -3);
            cache.InsertAll(ht);

            IEntryAggregator aggregator = new ComparableMin(IdentityExtractor.Instance);
            object           min        = cache.Aggregate(cache.Keys, aggregator);

            Assert.AreEqual(min, -3);

            IFilter filter = new AlwaysFilter();

            min = cache.Aggregate(filter, aggregator);
            Assert.AreEqual(min, -3);

            CacheFactory.Shutdown();
        }
        public void TestComparableComparerAggregator()
        {
            INamedCache cache = CacheFactory.GetCache(CacheName);

            cache.Clear();

            Hashtable ht = new Hashtable();

            ht.Add("1", new Address("street", "city", "state", "00000"));
            ht.Add("2", new Address("street", "city", "state", "20000"));
            ht.Add("3", new Address("street", "city", "state", "60000"));
            ht.Add("4", new Address("street", "city", "state", "50000"));
            ht.Add("5", new Address("street", "city", "state", "10000"));
            cache.InsertAll(ht);

            ArrayList al = new ArrayList(ht.Values);

            // setup for ComparableMax tests

            ComparableMax maxAgg = new ComparableMax(IdentityExtractor.Instance,
                                                     new SimpleAddressComparer());

            Assert.IsNotNull(maxAgg);
            Assert.AreSame(IdentityExtractor.Instance, maxAgg.Extractor);

            // local aggregation
            Assert.AreEqual("60000", ((Address)maxAgg.AggregateResults(al)).ZIP);

            // remote aggregation
            Address maxAddr = (Address)cache.Aggregate(new AlwaysFilter(), maxAgg);

            Assert.AreEqual("60000", maxAddr.ZIP);

            // setup for ComparableMin tests

            ComparableMin minAgg = new ComparableMin(IdentityExtractor.Instance,
                                                     new SimpleAddressComparer());

            Assert.IsNotNull(minAgg);
            Assert.AreSame(IdentityExtractor.Instance, minAgg.Extractor);

            // local aggregation
            Assert.AreEqual("00000", ((Address)minAgg.AggregateResults(al)).ZIP);

            // remote aggregation
            Address minAddr = (Address)cache.Aggregate(new AlwaysFilter(), minAgg);

            Assert.AreEqual("00000", minAddr.ZIP);

            CacheFactory.Shutdown();
        }