public void GetCpuPercentileFromCluster() { //Arrange var fixture = new Fixture(); var returnList = fixture.Create <List <CpuMetricModel> >(); _repository.Setup(a => a.GetMetricsFromTimeToTimeOrderBy(It.IsAny <DateTimeOffset>(), It.IsAny <DateTimeOffset>(), "value")) .Returns(returnList).Verifiable(); //Act var result = (OkObjectResult)_controller.GetMetricsByPercentileFromCluster( DateTimeOffset.FromUnixTimeSeconds(0), DateTimeOffset.FromUnixTimeSeconds(17000000000), Percentile.P90); //Assert _repository.Verify(repository => repository.GetMetricsFromTimeToTimeOrderBy( DateTimeOffset.FromUnixTimeSeconds(0), DateTimeOffset.FromUnixTimeSeconds(17000000000), "value"), Times.Once()); _ = Assert.IsAssignableFrom <IActionResult>(result); int percentileThisList = (int)Percentile.P90; percentileThisList = percentileThisList * returnList.Count / 100; var returnPercentile = returnList[percentileThisList].Value; Assert.Equal(returnPercentile, result.Value); _logger.Verify(); }