public void TestDoubleMinAggregator()
        {
            DoubleMin agg1 = new DoubleMin(IdentityExtractor.Instance);

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

            DoubleMin agg2 = new DoubleMin("dummy");

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

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

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

            ArrayList al = new ArrayList();

            al.Add(new TestInvocableCacheEntry("Ivan", 173.6));
            al.Add(new TestInvocableCacheEntry("Milica", 173.22));
            al.Add(new TestInvocableCacheEntry("Goran", 185.1));
            al.Add(new TestInvocableCacheEntry("Ana", 164.08));
            Assert.AreEqual(164.08, agg1.Aggregate(al));

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

            cache.Clear();

            Hashtable ht = new Hashtable();

            ht.Add("key1", 100);
            ht.Add("key2", 80.5);
            ht.Add("key3", 19.5);
            ht.Add("key4", 2);
            ht.Add("key5", 1011);
            cache.InsertAll(ht);

            IEntryAggregator aggregator = new DoubleMin(IdentityExtractor.Instance);
            object           result     = cache.Aggregate(cache.Keys, aggregator);

            Assert.AreEqual(2, result);

            cache.Insert("key10", -10);
            IFilter filter = new AlwaysFilter();

            result = cache.Aggregate(filter, aggregator);
            Assert.AreEqual(-10, result);

            CacheFactory.Shutdown();
        }
        public void TestAggregatorSerialization()
        {
            ConfigurablePofContext ctx = new ConfigurablePofContext("assembly://Coherence.Tests/Tangosol.Resources/s4hc-test-config.xml");

            Assert.IsNotNull(ctx);

            ComparableMax       comparableMax       = new ComparableMax("member1");
            ComparableMin       comparableMin       = new ComparableMin("member2");
            CompositeAggregator compositeAggregator = new CompositeAggregator();
            DecimalAverage      decimalAverage      = new DecimalAverage("member3");
            DecimalMax          decimalMax          = new DecimalMax("member4");
            DecimalMin          decimalMin          = new DecimalMin("member5");
            DecimalSum          decimalSum          = new DecimalSum("member6");
            DistinctValues      distinctValues      = new DistinctValues("member7");
            DoubleAverage       doubleAverage       = new DoubleAverage("member8");
            DoubleMax           doubleMax           = new DoubleMax("member9");
            DoubleMin           doubleMin           = new DoubleMin("member10");
            DoubleSum           doubleSum           = new DoubleSum("member11");
            GroupAggregator     groupAggregator     = new GroupAggregator();
            LongMax             longMax             = new LongMax("member12");
            LongMin             longMin             = new LongMin("member13");
            LongSum             longSum             = new LongSum("member14");
            PriorityAggregator  priorityAggregator  = new PriorityAggregator();
            Count count = new Count();

            Stream stream = new MemoryStream();

            ctx.Serialize(new DataWriter(stream), comparableMax);
            ctx.Serialize(new DataWriter(stream), comparableMin);
            ctx.Serialize(new DataWriter(stream), compositeAggregator);
            ctx.Serialize(new DataWriter(stream), decimalAverage);
            ctx.Serialize(new DataWriter(stream), decimalMax);
            ctx.Serialize(new DataWriter(stream), decimalMin);
            ctx.Serialize(new DataWriter(stream), decimalSum);
            ctx.Serialize(new DataWriter(stream), distinctValues);
            ctx.Serialize(new DataWriter(stream), doubleAverage);
            ctx.Serialize(new DataWriter(stream), doubleMax);
            ctx.Serialize(new DataWriter(stream), doubleMin);
            ctx.Serialize(new DataWriter(stream), doubleSum);
            ctx.Serialize(new DataWriter(stream), groupAggregator);
            ctx.Serialize(new DataWriter(stream), longMax);
            ctx.Serialize(new DataWriter(stream), longMin);
            ctx.Serialize(new DataWriter(stream), longSum);
            ctx.Serialize(new DataWriter(stream), priorityAggregator);
            ctx.Serialize(new DataWriter(stream), count);

            stream.Position = 0;
            Assert.AreEqual(comparableMax, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(comparableMin, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(compositeAggregator, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(decimalAverage, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(decimalMax, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(decimalMin, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(decimalSum, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(distinctValues, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(doubleAverage, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(doubleMax, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(doubleMin, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(doubleSum, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(groupAggregator, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(longMax, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(longMin, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(longSum, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(priorityAggregator.GetType(), ctx.Deserialize(new DataReader(stream)).GetType());
            Assert.AreEqual(count.GetType(), ctx.Deserialize(new DataReader(stream)).GetType());

            stream.Close();
        }