Пример #1
0
        public void GetMetricsData_Success()
        {
            const string webServiceId = "first";
            const bool   byRow        = false;
            const bool   fromFile     = true;
            const string filePath     = "";

            _loadTestDataManager
            .Setup(testDataManager => testDataManager.ReadTestData(webServiceId, fromFile, filePath))
            .Returns(_metricsData.ToString());
            _loadTestDataPreprocessor
            .Setup(loadTestDataPreprocessor => loadTestDataPreprocessor.PreprocessMetricsData(_metricsData.ToString(), webServiceId, byRow, fromFile, true))
            .Returns(_metricsData);

            var apdexScoreEstimator = new ApdexScoreEstimator(_loadTestDataManager.Object, _loadTestDataPreprocessor.Object);

            apdexScoreEstimator.GetMetricsData(webServiceId, fromFile, byRow);
            var result = apdexScoreEstimator.MetricsData;

            Assert.IsType <List <string[]> >(result);
            Assert.Equal(_metricsData, result);
        }
Пример #2
0
        public void FindApdexScoreEstimatorResult_FromFileAndPredefinedLimit_Success()
        {
            const string webServiceId                = "first";
            const bool   byRow                       = false;
            const bool   fromFile                    = true;
            const string filePath                    = "";
            const double apdexScoreLimit             = 0.05;
            ApdexScoreEstimatorResult expectedResult = new ApdexScoreEstimatorResult()
            {
                ApdexScoreEstimations = new List <ApdexScoreEstimation>()
                {
                    new ApdexScoreEstimation()
                    {
                        IntervalStartTime = "15:55:38",
                        IntervalEndTime   = "15:55:43",
                        ApdexScore        = 0
                    },
                    new ApdexScoreEstimation()
                    {
                        IntervalStartTime = "15:55:43",
                        IntervalEndTime   = "15:55:48",
                        ApdexScore        = 0
                    },
                    new ApdexScoreEstimation()
                    {
                        IntervalStartTime = "15:55:48",
                        IntervalEndTime   = "15:55:53",
                        ApdexScore        = 0
                    },
                    new ApdexScoreEstimation()
                    {
                        IntervalStartTime = "15:55:53",
                        IntervalEndTime   = "15:55:58",
                        ApdexScore        = 0
                    },
                    new ApdexScoreEstimation()
                    {
                        IntervalStartTime = "15:55:58",
                        IntervalEndTime   = "15:56:03",
                        ApdexScore        = 0
                    }
                },
                AverageApdexScoreEstimation = 0,
                ApdexScoreEstimationRating  = "Unacceptable",
                InitialApdexScoreLimit      = 0.7731667
            };

            _loadTestDataManager
            .Setup(testDataManager => testDataManager.ReadTestData(webServiceId, fromFile, filePath))
            .Returns(_metricsData.ToString());
            _loadTestDataPreprocessor
            .Setup(loadTestDataPreprocessor => loadTestDataPreprocessor.PreprocessMetricsData(_metricsData.ToString(), webServiceId, byRow, fromFile, true))
            .Returns(_metricsData);

            var apdexScoreEstimator = new ApdexScoreEstimator(_loadTestDataManager.Object, _loadTestDataPreprocessor.Object);

            apdexScoreEstimator.GetMetricsData(webServiceId, fromFile, byRow);
            var result = apdexScoreEstimator.FindApdexScoreEstimatorResult(apdexScoreLimit, fromFile, webServiceId);

            Assert.IsType <ApdexScoreEstimatorResult>(result);
            Assert.Equal <ApdexScoreEstimatorResult>(expectedResult, result);
        }