Exemplo n.º 1
0
 public void test_FixedPointSum()
 {
     FillMap <float>();
     FillMap <double>();
     Assert.AreEqual(90, map.Aggregate(Aggregators.FixedPointSum()));
     Assert.AreEqual(90, map.Aggregate(Aggregators.FixedPointSum("this")));
 }
        public async Task Test_FixedPointSum_MixedObject()
        {
            var name = CreateUniqueName();

            await using var dictionary = await Client.GetMapAsync <string, object>(name);

            await Fill(dictionary, i => (int)i);
            await Fill(dictionary, i => (long)i);

            Assert.AreEqual(90, await dictionary.AggregateAsync(Aggregators.FixedPointSum()));
            Assert.AreEqual(90, await dictionary.AggregateAsync(Aggregators.FixedPointSum("this")));
        }
        public async Task Test_FixedPointSum_MixedGeneric()
        {
            var name = CreateUniqueName();

            await using (var dictionary = await Client.GetMapAsync <string, int>(name))
            {
                await Fill(dictionary, i => i);
            }

            await using (var dictionary = await Client.GetMapAsync <string, long>(name))
            {
                await Fill(dictionary, i => i);
            }

            await using var d = await Client.GetMapAsync <string, int>(name);

            Assert.AreEqual(90, await d.AggregateAsync(Aggregators.FixedPointSum()));
            Assert.AreEqual(90, await d.AggregateAsync(Aggregators.FixedPointSum("this")));
        }
Exemplo n.º 4
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);
        }