private int GetTotalTestCases(Iteration iteration) { int count = 0; foreach (var testPlan in iteration.TestPlans) { foreach (var testRun in testPlan.TestRuns) { count += GetDistinctResults(testRun.TestRunID).Count(); } } return count; }
private object[,] GetRemainingEffortPerDay(Iteration iteration) { // Initialize list with dates List<string> dates = new List<string>(); List<DateTime> xAxisData = new List<DateTime>(); DateTime d = iteration.StartDate; // Build lists with iteration dates: {dates} contains just the string like yyyy/mm/dd and {xAxisData} contains DateTimes while (d.ToShortDateString().CompareTo(DateTime.Now.ToShortDateString()) <= 0) { dates.Add(d.ToShortDateString()); xAxisData.Add(d); d = d.AddDays(1); } // Initialize array with untested counts as 0 for each date int[] untested = new int[dates.Count]; for (int date = 0; date < untested.Length; date++) { untested[date] = GetTotalTestCases(iteration); } for (int i = 0; i < dates.Count(); i++) { int count = 0; foreach (var testPlan in iteration.TestPlans) foreach (var testRun in testPlan.TestRuns) { ICollection<Result> distinctResults = GetDistinctResultsPerDate(testRun.TestRunID, dates.ElementAt(i)); foreach (var result in distinctResults) { if (result.State.Equals(State.Untested)) count++; } } untested[i] = count; } // Build 2D object array to return var data = new object[dates.Count + 1, 2]; data[0, 0] = iteration.StartDate.AddDays(-1); data[0, 1] = GetTotalTestCases(iteration); for (int i = 1; i <= dates.Count(); i++) { data[i, 0] = xAxisData.ElementAt(i - 1); data[i, 1] = untested[i - 1]; } return data; }