public void GetFuzzyLogicEstimatorResult_Failure_InvalidWebServiceId() { const string webServiceId = null; var estimatorController = new EstimatorController(_loadTestDataManager.Object, _apdexScoreEstimator.Object, _clusterEstimator.Object, _fuzzyLogicEstimator.Object, _statisticalEstimator.Object); var result = estimatorController.GetFuzzyLogicEstimatorResult(webServiceId); Assert.IsType <BadRequestObjectResult>(result); }
public void GetFuzzyLogicEstimatorResult_Failure_MissingWebServiceId() { const string webServiceId = "first"; var estimatorController = new EstimatorController(_loadTestDataManager.Object, _apdexScoreEstimator.Object, _clusterEstimator.Object, _fuzzyLogicEstimator.Object, _statisticalEstimator.Object); estimatorController.ModelState.AddModelError("webServiceId", "missing webServiceId"); var result = estimatorController.GetFuzzyLogicEstimatorResult(webServiceId); Assert.IsType <BadRequestObjectResult>(result); }
public void GetFuzzyLogicEstimatorResult_Failure_ThrowsException() { const string webServiceId = "first"; const bool byRow = false; const bool fromFile = false; _metricsDataManager.Setup(metricsDataManager => metricsDataManager.GetMetricsData(webServiceId, fromFile, byRow)); _fuzzyLogicEstimator.Setup(fuzzyLogicEstimator => fuzzyLogicEstimator.GetAggregatedQualityMembershipFunction()); _fuzzyLogicEstimator .Setup(fuzzyLogicEstimator => fuzzyLogicEstimator.AggregatedQualityMembershipFunction) .Throws(new Exception()); var estimatorController = new EstimatorController(_loadTestDataManager.Object, _apdexScoreEstimator.Object, _clusterEstimator.Object, _fuzzyLogicEstimator.Object, _statisticalEstimator.Object); Assert.Throws <Exception>(() => estimatorController.GetFuzzyLogicEstimatorResult(webServiceId)); }
public void GetFuzzyLogicEstimatorResult_Success() { const string webServiceId = "first"; const bool byRow = false; const bool fromFile = false; IList <double> expectedResult = new List <double>() { 0.4565, 0.2345 }; _metricsDataManager.Setup(metricsDataManager => metricsDataManager.GetMetricsData(webServiceId, fromFile, byRow)); _fuzzyLogicEstimator.Setup(fuzzyLogicEstimator => fuzzyLogicEstimator.GetAggregatedQualityMembershipFunction()); _fuzzyLogicEstimator.Setup(fuzzyLogicEstimator => fuzzyLogicEstimator.AggregatedQualityMembershipFunction).Returns(expectedResult); var estimatorController = new EstimatorController(_loadTestDataManager.Object, _apdexScoreEstimator.Object, _clusterEstimator.Object, _fuzzyLogicEstimator.Object, _statisticalEstimator.Object); var actualResult = estimatorController.GetFuzzyLogicEstimatorResult(webServiceId); var okResult = Assert.IsType <OkObjectResult>(actualResult); var returnValue = Assert.IsType <List <double> >(okResult.Value); Assert.Equal(expectedResult, returnValue); }