public TestResultSummaryViewModel(TestResultSummary summary, PipelineConfiguration pipelineConfiguration, bool includeOthersInTotal) { PassedTests = 0; FailedTests = 0; if (summary.AggregatedResultsAnalysis.ResultsByOutcome.ContainsKey(TestOutcome.Passed)) { PassedTests = summary.AggregatedResultsAnalysis.ResultsByOutcome[TestOutcome.Passed].Count; } if (summary.AggregatedResultsAnalysis.ResultsByOutcome.ContainsKey(TestOutcome.Failed)) { FailedTests = summary.AggregatedResultsAnalysis.ResultsByOutcome[TestOutcome.Failed].Count; } TotalTests = summary.AggregatedResultsAnalysis.TotalTests; OtherTests = TotalTests - PassedTests - FailedTests; if (!includeOthersInTotal) { TotalTests -= OtherTests; } PassingRate = TestResultsHelper.GetTestOutcomePercentageString(PassedTests, TotalTests); Duration = TimeSpanFormatter.FormatDurationWithUnit(summary.AggregatedResultsAnalysis.Duration); Url = pipelineConfiguration.TestTabLink; }
public TestResultSummaryViewModel(TestSummaryItem summaryItem, PipelineConfiguration pipelineConfiguration, bool includeOthersInTotal) { PassedTests = summaryItem.GetPassedTestsCount(); FailedTests = summaryItem.GetFailedTestsCount(); OtherTests = summaryItem.GetOtherTestsCount(); TotalTests = TestResultsHelper.GetTotalTestCountBasedOnUserConfiguration(summaryItem.TestCountByOutCome, includeOthersInTotal); PassingRate = TestResultsHelper.GetTestOutcomePercentageString(PassedTests, TotalTests); Duration = TimeSpanFormatter.FormatDurationWithUnit(summaryItem.Duration); Url = pipelineConfiguration.TestTabLink; }