Exemplo n.º 1
0
        public async Task <double> CalculatePercentile(double excelPercentile)
        {
            var data = await _testDataRepository.FindAll();

            var array = data.Select(x => x.Data).ToArray();

            var results = FunctionHelper.Percentile(array, excelPercentile);

            return(results);
        }
Exemplo n.º 2
0
        public async Task <ActionResult <IEnumerable <TestData> > > Get()
        {
            var results = await _testDataRepository.FindAll().ConfigureAwait(false);

            if (results == null)
            {
                return(NotFound());
            }

            return(Ok(results));
        }
Exemplo n.º 3
0
        public async Task Can_Calculate_Percentile()
        {
            // Arrange
            double result  = 9949.9563797144219;
            var    results = await _testDataRepository.FindAll();

            var array = results.Select(x => x.Data).ToArray();

            // Act
            var sut = FunctionHelper.Percentile(array, 0.995);

            // Assert
            _output.WriteLine($"Result:{sut}");
            Assert.NotNull(results);
            Assert.Equal(sut, result);
        }