public void TestCountReviews() { var repository = new ReviewRepository(); var nReviews = repository.GetAllByProjectId(13).Count(); Assert.IsTrue(nReviews == 8); }
private ComplianceIndicatorsViewModel GenerateProgrammeIndicators(ComplianceIndicatorsViewModel vm) { vm = ClearTheView(vm); var countList = new Dictionary <string, CountStat>(); var projectList = projectRepository.GetAll(new DateTime(1, 1, 1), new DateTime(1, 1, 1)); foreach (var project in projectList) { var projectProgrammeList = projectContractRepository.GetAllByProjectId(project.ProjectId); vm.ProjectsRead++; var reviewList = reviewRepository.GetAllByProjectId(project.ProjectId); foreach (var review in reviewList) { //if ( ( review.OrgCode != "BALT" ) || review.ESACode != "4TWE" || review.Quarter() != "20122" ) continue; //TODO: take this away its just to speed testing //if ( ( review.OrgCode != "LEON" ) || review.ESACode != "4ONB" || review.Quarter() != "20114" // || (review.ProjectId != 255 && review.ProjectId != 333 ) ) continue; //TODO: take this away its just to speed testing ProcessReview(vm, review, countList, project, projectProgrammeList); } } #if DEBUG // for proof of calculation foreach (var pair in countList) { var ciLine = string.Format("Key:{0} - {1} - {2}", pair.Key, pair.Value, pair.Value.ReviewList()); var ua = new UserActivity { Activity = ciLine, UserId = "CI-GEN" }; activityRepository.Add(ua); } #endif StoreIndicators(countList, vm); return(vm); }