private static Dictionary <string, Dictionary <string, TestResult> > SummarizeTestResults(IEnumerable <TestIterationResult> allIterations) { var testResults = new Dictionary <string, Dictionary <string, TestResult> >(); foreach (var iteration in allIterations) { Dictionary <string, TestResult> runResults; if (!testResults.TryGetValue(iteration.RunId, out runResults)) { testResults[iteration.RunId] = runResults = new Dictionary <string, TestResult>(); } TestResult result; if (!runResults.TryGetValue(iteration.TestName, out result)) { runResults[iteration.TestName] = result = new TestResult(); result.RunId = iteration.RunId; result.TestName = iteration.TestName; } foreach (var metric in iteration.MetricValues) { TestStatistics stats; if (!result.Stats.TryGetValue(metric.Key, out stats)) { result.Stats[metric.Key] = stats = new TestStatistics(); } stats.Push(metric.Value); } result.Iterations.Add(iteration); } return(testResults); }
private static Dictionary<string, Dictionary<string, TestResult>> SummarizeTestResults(IEnumerable<TestIterationResult> allIterations, out HashSet<string> metricsFound) { var testResults = new Dictionary<string, Dictionary<string, TestResult>>(); metricsFound = new HashSet<string>(); foreach (var iteration in allIterations) { Dictionary<string, TestResult> runResults; if (!testResults.TryGetValue(iteration.RunId, out runResults)) testResults[iteration.RunId] = runResults = new Dictionary<string, TestResult>(); TestResult result; if (!runResults.TryGetValue(iteration.TestName, out result)) { runResults[iteration.TestName] = result = new TestResult(); result.RunId = iteration.RunId; result.TestName = iteration.TestName; } foreach (var metric in iteration.MetricValues) { TestStatistics stats; if (!result.Stats.TryGetValue(metric.Key, out stats)) { result.Stats[metric.Key] = stats = new TestStatistics(); metricsFound.Add(metric.Key); } stats.Push(metric.Value); } result.Iterations.Add(iteration); } return testResults; }