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 statisticalEstimator = new StatisticalEstimator(_loadTestDataManager.Object, _loadTestDataPreprocessor.Object); statisticalEstimator.GetMetricsData(webServiceId, fromFile, byRow); var result = statisticalEstimator.MetricsData; Assert.IsType <List <string[]> >(result); Assert.Equal(_metricsData.Skip(2).ToList(), result); }
public void FindStatisticalEstimatorResult_Success_FromFile() { const string webServiceId = "first"; const bool byRow = false; const bool fromFile = true; const string filePath = ""; IEnumerable <StatisticalEstimation> expectedResult = new List <StatisticalEstimation>() { new StatisticalEstimation() { MetricName = "ResponseTime", Min = 0.6421428, LowerQuartile = 0.64890473333333332, Median = 0.6745715, UpperQuartile = 0.83994446666666667, Max = 0.9735, Mean = 0.74313334, Variance = 0.019280977379922987 }, new StatisticalEstimation() { MetricName = "SuccessfulRequestsPerSecond", Min = 0.8, LowerQuartile = 1.0666666666666667, Median = 1.4, UpperQuartile = 1.4, Max = 1.4, Mean = 1.24, Variance = 0.0679999999999999 }, new StatisticalEstimation() { MetricName = "FailedRequestsPerSecond", Min = 0, LowerQuartile = 0, Median = 0, UpperQuartile = 0, Max = 0, Mean = 0, Variance = 0 }, new StatisticalEstimation() { MetricName = "SentKilobytesPerSecond", Min = 3.025, LowerQuartile = 3.025, Median = 3.025, UpperQuartile = 3.025, Max = 3.025, Mean = 3.025, Variance = 0 } }; _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 statisticalEstimator = new StatisticalEstimator(_loadTestDataManager.Object, _loadTestDataPreprocessor.Object); statisticalEstimator.GetMetricsData(webServiceId, fromFile, byRow); var result = statisticalEstimator.FindStatisticalEstimatorResult(); Assert.IsAssignableFrom <IEnumerable <StatisticalEstimation> >(result); Assert.Equal <IEnumerable <StatisticalEstimation> >(expectedResult, result); }