public async Task GetAssessorPageReviewOutcomeHandler_returns__PageReviewOutcome() { var expectedApplicationId = Guid.NewGuid(); var expectedSequenceNumber = 1; var expectedSectionNumber = 2; var expectedPageId = "30"; var expectedUserId = "4fs7f-userId-7gfhh"; var expectedStatus = "Fail"; var expectedComment = "Very bad"; var expectedResult = new AssessorPageReviewOutcome { ApplicationId = expectedApplicationId, SequenceNumber = expectedSequenceNumber, SectionNumber = expectedSectionNumber, PageId = expectedPageId, UserId = expectedUserId, Status = expectedStatus, Comment = expectedComment }; _repository.Setup(x => x.GetAssessorPageReviewOutcome(expectedApplicationId, expectedSequenceNumber, expectedSectionNumber, expectedPageId, expectedUserId)).ReturnsAsync(expectedResult); var actualResult = await _handler.Handle(new GetAssessorPageReviewOutcomeRequest(expectedApplicationId, expectedSequenceNumber, expectedSectionNumber, expectedPageId, expectedUserId), new CancellationToken()); Assert.AreSame(expectedResult, actualResult); }
public async Task GetPageReviewOutcome_returns_expected_PageReviewOutcome() { var request = new RoatpAssessorController.GetPageReviewOutcomeRequest { SequenceNumber = _sequenceNumber, SectionNumber = _sectionNumber, PageId = _pageId, UserId = _userId }; var expectedResult = new AssessorPageReviewOutcome(); _mediator.Setup(x => x.Send(It.Is <GetAssessorPageReviewOutcomeRequest>(r => r.ApplicationId == _applicationId && r.SequenceNumber == request.SequenceNumber && r.SectionNumber == request.SectionNumber && r.PageId == request.PageId && r.UserId == request.UserId), It.IsAny <CancellationToken>())).ReturnsAsync(expectedResult); var actualResult = await _controller.GetPageReviewOutcome(_applicationId, request); _mediator.Verify(x => x.Send(It.Is <GetAssessorPageReviewOutcomeRequest>(r => r.ApplicationId == _applicationId && r.SequenceNumber == request.SequenceNumber && r.SectionNumber == request.SectionNumber && r.PageId == request.PageId && r.UserId == request.UserId), It.IsAny <CancellationToken>()), Times.Once); Assert.AreSame(expectedResult, actualResult); }
public void SetUp() { var logger = new Mock <ILogger <Web.Services.AssessorSectionReviewOrchestrator> >(); _applyApiClient = new Mock <IRoatpApplicationApiClient>(); _assessorApiClient = new Mock <IRoatpAssessorApiClient>(); var supplementaryInformationService = new Mock <ISupplementaryInformationService>(); _orchestrator = new Web.Services.AssessorSectionReviewOrchestrator(logger.Object, _applyApiClient.Object, _assessorApiClient.Object, supplementaryInformationService.Object); _userId = _user.UserId(); _application = new Apply { ApplicationId = _applicationId, ApplyData = new ApplyData { ApplyDetails = new ApplyDetails { } }, Assessor1UserId = _userId }; _contact = new Contact { Email = _userId, GivenNames = _user.GivenName(), FamilyName = _user.Surname() }; _assessorPage = new AssessorPage { ApplicationId = _applicationId, SequenceNumber = _sequenceNumber, SectionNumber = _sectionNumber, PageId = _pageId, Questions = new List <Question> { new Question { QuestionId = "Q1" } }, Answers = new List <Answer> { new Answer { QuestionId = "Q1", Value = "value" } } }; _pageReviewOutcome = new AssessorPageReviewOutcome { ApplicationId = _applicationId, SequenceNumber = _sequenceNumber, SectionNumber = _sectionNumber, PageId = _pageId, UserId = _userId, Status = AssessorPageReviewStatus.Pass }; _applyApiClient.Setup(x => x.GetApplication(_applicationId)).ReturnsAsync(_application); _applyApiClient.Setup(x => x.GetContactForApplication(_applicationId)).ReturnsAsync(_contact); _assessorApiClient.Setup(x => x.GetAssessorPage(_applicationId, _sequenceNumber, _sectionNumber, _pageId)) .ReturnsAsync(_assessorPage); _assessorApiClient.Setup(x => x.GetAssessorPageReviewOutcomesForSection(_applicationId, _sequenceNumber, _sectionNumber, _userId)) .ReturnsAsync(new List <AssessorPageReviewOutcome> { _pageReviewOutcome }); _assessorApiClient.Setup(x => x.GetAssessorPageReviewOutcome(_applicationId, _sequenceNumber, _sectionNumber, _pageId, _userId)) .ReturnsAsync(_pageReviewOutcome); }