Exemple #1
0
        public void GetStatisticalEstimatorResult_Success()
        {
            const string webServiceId = "first";
            const bool   byRow        = false;
            const bool   fromFile     = false;
            List <StatisticalEstimation> expectedResult = new List <StatisticalEstimation>()
            {
                new StatisticalEstimation()
                {
                    MetricName    = "test",
                    Min           = 0,
                    Max           = 50,
                    Median        = 25,
                    Mean          = 25,
                    Variance      = 0,
                    LowerQuartile = 15,
                    UpperQuartile = 35
                }
            };

            _metricsDataManager.Setup(metricsDataManager => metricsDataManager.GetMetricsData(webServiceId, fromFile, byRow));
            _statisticalEstimator.Setup(statisticalEstimator => statisticalEstimator.FindStatisticalEstimatorResult()).Returns(expectedResult);

            var estimatorController = new EstimatorController(_loadTestDataManager.Object, _apdexScoreEstimator.Object,
                                                              _clusterEstimator.Object, _fuzzyLogicEstimator.Object, _statisticalEstimator.Object);

            var actualResult = estimatorController.GetStatisticalEstimatorResult(webServiceId);
            var okResult     = Assert.IsType <OkObjectResult>(actualResult);
            var returnValue  = Assert.IsType <List <StatisticalEstimation> >(okResult.Value);

            Assert.Equal(expectedResult, returnValue);
        }
Exemple #2
0
        public void GetStatisticalEstimatorResult_Failure_InvalidWebServiceId()
        {
            const string webServiceId = null;

            var estimatorController = new EstimatorController(_loadTestDataManager.Object, _apdexScoreEstimator.Object,
                                                              _clusterEstimator.Object, _fuzzyLogicEstimator.Object, _statisticalEstimator.Object);

            var result = estimatorController.GetStatisticalEstimatorResult(webServiceId);

            Assert.IsType <BadRequestObjectResult>(result);
        }
Exemple #3
0
        public void GetStatisticalEstimatorResult_Failure_ThrowsException()
        {
            const string webServiceId = "first";
            const bool   byRow        = false;
            const bool   fromFile     = false;

            _metricsDataManager.Setup(metricsDataManager => metricsDataManager.GetMetricsData(webServiceId, fromFile, byRow));
            _statisticalEstimator
            .Setup(statisticalEstimator => statisticalEstimator.FindStatisticalEstimatorResult())
            .Throws(new Exception());

            var estimatorController = new EstimatorController(_loadTestDataManager.Object, _apdexScoreEstimator.Object,
                                                              _clusterEstimator.Object, _fuzzyLogicEstimator.Object, _statisticalEstimator.Object);

            Assert.Throws <Exception>(() => estimatorController.GetStatisticalEstimatorResult(webServiceId));
        }