public IEnumerable <SuiteSummary> GetLatest() { var suites = _suiteService.GetAll(); var allTemporaryTestResults = _db.TemporaryTestResults.AsNoTracking().ToList(); var suiteSummaries = new List <SuiteSummary>(); foreach (var suite in suites) { var temporaryTestResultsForSuite = allTemporaryTestResults.Where(t => t.SuiteId == suite.SuiteID); var firstTemporaryTestResult = temporaryTestResultsForSuite.FirstOrDefault(); var suiteEndTime = firstTemporaryTestResult == null ? null : firstTemporaryTestResult.SuiteResult.SuiteResultEndDateTime; suiteSummaries.Add( new SuiteSummary { SuiteIds = new List <int> { suite.SuiteID }, SuiteName = suite.GetName(), TotalFailedTests = temporaryTestResultsForSuite.Where(t => t.TestResultTypeId == 1).Count(), TotalInconclusiveTests = temporaryTestResultsForSuite.Where(t => t.TestResultTypeId == 2).Count(), TotalPassedTests = temporaryTestResultsForSuite.Where(t => t.TestResultTypeId == 3).Count(), SuiteEndTime = suiteEndTime } ); } return(suiteSummaries); }
public IEnumerable <LatestTestResultDto> GetLatestGrouped(int suiteId) { var suite = _suiteService.Get(suiteId); var suiteIds = _suiteService.GetAll() .Where(s => s.EnvironmentId == suite.EnvironmentId && s.ApplicationId == suite.ApplicationId) .Select(s => s.SuiteID) .ToArray(); var latestTestResults = _latestTestResultService.Get(suiteIds).ToList(); latestTestResults = AssignTestFailureDurations(latestTestResults); return(Sort(latestTestResults)); }
public IEnumerable <SuiteIndexViewModel> Get(int skip, int pageSize) { var suites = _suiteService.GetAll() .Include(x => x.Gallery) .Include(x => x.Camp) .Include(x => x.SuiteGrade) .Include(x => x.SuiteOwner) .Include(x => x.SuiteType) .Include(x => x.Phones) .OrderByDescending(x => x.Id) .Skip(skip) .Take(pageSize) .ToList(); var models = Mapper.Map <IList <Suite>, IList <SuiteIndexViewModel> >(suites); return(models); }