public async Task GetNumberAggregationsAsync() { await CreateDataAsync(); const string aggregations = "min:age max:age avg:age sum:age percentiles:age min:createdUtc max:createdUtc"; var result = await _employeeRepository.GetCountByQueryAsync(q => q.AggregationsExression(aggregations)); Assert.Equal(10, result.Total); Assert.Equal(7, result.Aggregations.Count); Assert.Equal(19, result.Aggregations.Min("min_age").Value); Assert.Equal(60, result.Aggregations.Max("max_age").Value); Assert.Equal(34.7, result.Aggregations.Average("avg_age").Value); Assert.Equal(347, result.Aggregations.Sum("sum_age").Value); var percentiles = result.Aggregations.Percentiles("percentiles_age"); Assert.Equal(SystemClock.UtcNow.Date.SubtractYears(10), result.Aggregations.Min <DateTime>("min_createdUtc").Value); Assert.Equal(SystemClock.UtcNow.Date.SubtractYears(1), result.Aggregations.Max <DateTime>("max_createdUtc").Value); Assert.Equal(19.27, percentiles.GetPercentile(1).Value); Assert.Equal(20.35, percentiles.GetPercentile(5).Value); Assert.Equal(26d, percentiles.GetPercentile(25).Value); Assert.Equal(30.5, percentiles.GetPercentile(50).Value); Assert.Equal(42.5, percentiles.GetPercentile(75).Value); Assert.Equal(55.94999999999999, percentiles.GetPercentile(95).Value); Assert.Equal(59.19, percentiles.GetPercentile(99).Value); }