public async Task Test_DoubleAvg()
        {
            var dictionary = await Client.GetMapAsync <string, double>(CreateUniqueName());

            await using var _ = DestroyAndDispose(dictionary);

            await Fill(dictionary, i => i);

            Assert.AreEqual(4.5d, await dictionary.AggregateAsync(Aggregators.DoubleAvg()));
            Assert.AreEqual(4.5d, await dictionary.AggregateAsync(Aggregators.DoubleAvg("this")));
        }
Esempio n. 2
0
        public void Tests()
        {
            AssertAggregator((CountAggregator)Aggregators.Count("name"), AggregatorDataSerializerHook.Count);

            AssertAggregator((BigIntegerSumAggregator)Aggregators.BigIntegerSum("name"), AggregatorDataSerializerHook.BigIntSum);
            AssertAggregator((DoubleSumAggregator)Aggregators.DoubleSum("name"), AggregatorDataSerializerHook.DoubleSum);
            AssertAggregator((FixedSumAggregator)Aggregators.FixedPointSum("name"), AggregatorDataSerializerHook.FixedSum);
            AssertAggregator((LongSumAggregator)Aggregators.LongSum("name"), AggregatorDataSerializerHook.LongSum);
            AssertAggregator((FloatingPointSumAggregator)Aggregators.FloatingPointSum("name"), AggregatorDataSerializerHook.FloatingPointSum);
            AssertAggregator((IntegerSumAggregator)Aggregators.IntegerSum("name"), AggregatorDataSerializerHook.IntSum);

            AssertAggregator((NumberAverageAggregator)Aggregators.NumberAvg("name"), AggregatorDataSerializerHook.NumberAvg);
            AssertAggregator((DoubleAverageAggregator)Aggregators.DoubleAvg("name"), AggregatorDataSerializerHook.DoubleAvg);
            AssertAggregator((IntegerAverageAggregator)Aggregators.IntegerAvg("name"), AggregatorDataSerializerHook.IntAvg);
            AssertAggregator((LongAverageAggregator)Aggregators.LongAvg("name"), AggregatorDataSerializerHook.LongAvg);

            AssertAggregator((MaxAggregator <int>)Aggregators.Max <int>("name"), AggregatorDataSerializerHook.Max);
            AssertAggregator((MinAggregator <int>)Aggregators.Min <int>("name"), AggregatorDataSerializerHook.Min);

            AssertAggregator((CountAggregator)Aggregators.Count(), AggregatorDataSerializerHook.Count);

            AssertAggregator((BigIntegerSumAggregator)Aggregators.BigIntegerSum(), AggregatorDataSerializerHook.BigIntSum);
            AssertAggregator((DoubleSumAggregator)Aggregators.DoubleSum(), AggregatorDataSerializerHook.DoubleSum);
            AssertAggregator((FixedSumAggregator)Aggregators.FixedPointSum(), AggregatorDataSerializerHook.FixedSum);
            AssertAggregator((LongSumAggregator)Aggregators.LongSum(), AggregatorDataSerializerHook.LongSum);
            AssertAggregator((FloatingPointSumAggregator)Aggregators.FloatingPointSum(), AggregatorDataSerializerHook.FloatingPointSum);
            AssertAggregator((IntegerSumAggregator)Aggregators.IntegerSum(), AggregatorDataSerializerHook.IntSum);

            AssertAggregator((NumberAverageAggregator)Aggregators.NumberAvg(), AggregatorDataSerializerHook.NumberAvg);
            AssertAggregator((DoubleAverageAggregator)Aggregators.DoubleAvg(), AggregatorDataSerializerHook.DoubleAvg);
            AssertAggregator((IntegerAverageAggregator)Aggregators.IntegerAvg(), AggregatorDataSerializerHook.IntAvg);
            AssertAggregator((LongAverageAggregator)Aggregators.LongAvg(), AggregatorDataSerializerHook.LongAvg);

            AssertAggregator((MaxAggregator <int>)Aggregators.Max <int>(), AggregatorDataSerializerHook.Max);
            AssertAggregator((MinAggregator <int>)Aggregators.Min <int>(), AggregatorDataSerializerHook.Min);
        }
Esempio n. 3
0
 public void test_DoubleAvg()
 {
     FillMap <double>();
     Assert.AreEqual(4.5d, map.Aggregate(Aggregators.DoubleAvg()));
     Assert.AreEqual(4.5d, map.Aggregate(Aggregators.DoubleAvg("this")));
 }