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); }
public async Task <ActionResult <IEnumerable <TestData> > > Get() { var results = await _testDataRepository.FindAll().ConfigureAwait(false); if (results == null) { return(NotFound()); } return(Ok(results)); }
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); }