public async Task CreateEmptyReview_creates_empty_review_outcomes(bool injectFinancialInformationPage) { _assessorSequenceService.Setup(x => x.ShouldInjectFinancialInformationPage(_applicationId)).ReturnsAsync(injectFinancialInformationPage); await _assessorReviewCreationService.CreateEmptyReview(_applicationId, _assessorUserId, _assessorUserName, _assessorNumber); var allSections = _sequences.SelectMany(seq => seq.Sections); var allSectionsExcludingSectors = allSections.Where(sec => sec.SequenceNumber != RoatpWorkflowSequenceIds.DeliveringApprenticeshipTraining || sec.SectionNumber != RoatpWorkflowSectionIds.DeliveringApprenticeshipTraining.YourSectorsAndEmployees); var sectionPages = allSectionsExcludingSectors.SelectMany(sec => sec.Pages).ToList(); var expectedNumberOfOutcomes = sectionPages.Count + _sectors.Count; if (injectFinancialInformationPage) { expectedNumberOfOutcomes += 1; } _mediator.Verify(x => x.Send(It.Is <CreateEmptyAssessorReviewRequest>(r => r.PageReviewOutcomes.Count == expectedNumberOfOutcomes && r.PageReviewOutcomes.TrueForAll(y => _sectors.Exists(s => s.PageId == y.PageId) || sectionPages.Exists(p => p.PageId == y.PageId) || y.PageId == RoatpWorkflowPageIds.DeliveringApprenticeshipTraining.ManagementHierarchy_Financial)), It.IsAny <CancellationToken>()), Times.Once); }
public async Task CreateEmptyReview_creates_empty_review_outcomes() { await _assessorReviewCreationService.CreateEmptyReview(_applicationId, _assessorUserId, _assessorUserName, _assessorNumber); var allSections = _sequences.SelectMany(seq => seq.Sections); var allSectionsExclusingSectors = allSections.Where(sec => sec.SequenceNumber != RoatpWorkflowSequenceIds.DeliveringApprenticeshipTraining || sec.SectionNumber != RoatpWorkflowSectionIds.DeliveringApprenticeshipTraining.YourSectorsAndEmployees); var sectionPages = allSectionsExclusingSectors.SelectMany(sec => sec.Pages).ToList(); var expectedNumberOfOutcomes = sectionPages.Count + _sectors.Count; _mediator.Verify(x => x.Send(It.Is <CreateEmptyAssessorReviewRequest>(r => r.PageReviewOutcomes.Count == expectedNumberOfOutcomes && r.PageReviewOutcomes.TrueForAll(y => _sectors.Exists(s => s.PageId == y.PageId) || sectionPages.Exists(p => p.PageId == y.PageId))), It.IsAny <CancellationToken>()), Times.Once); }