public async Task clarifying_office_for_students_saves_evaluation_result() { var applicationId = Guid.NewGuid(); var pageId = GatewayPageIds.OfficeForStudents; var vm = new OfficeForStudentsViewModel { ApplicationId = applicationId, PageId = pageId, Status = SectionReviewStatus.Pass, SourcesCheckedOn = DateTime.Now, ErrorMessages = new List <ValidationErrorDetail>(), OptionPassText = "Some pass text", ClarificationAnswer = ClarificationAnswer }; var command = new SubmitGatewayPageAnswerCommand(vm); GatewayValidator.Setup(v => v.ValidateClarification(command)).ReturnsAsync(new ValidationResponse { Errors = new List <ValidationErrorDetail>() }); await _controller.ClarifyOfficeForStudentsPage(command); ApplyApiClient.Verify(x => x.SubmitGatewayPageAnswerPostClarification(applicationId, pageId, vm.Status, UserId, Username, vm.OptionPassText, ClarificationAnswer)); }
public async Task saving_office_for_students_without_required_fields_does_not_save() { var applicationId = Guid.NewGuid(); var pageId = GatewayPageIds.OfficeForStudents; var vm = new OfficeForStudentsViewModel { Status = SectionReviewStatus.Fail, SourcesCheckedOn = DateTime.Now, ErrorMessages = new List <ValidationErrorDetail>(), ApplicationId = applicationId, PageId = pageId }; var command = new SubmitGatewayPageAnswerCommand(vm); GatewayValidator.Setup(v => v.Validate(command)) .ReturnsAsync(new ValidationResponse { Errors = new List <ValidationErrorDetail> { new ValidationErrorDetail { Field = "OptionFail", ErrorMessage = "needs text" } } } ); _orchestrator.Setup(x => x.GetOfficeForStudentsViewModel(It.Is <GetOfficeForStudentsRequest>(y => y.ApplicationId == vm.ApplicationId && y.UserName == Username))).ReturnsAsync(vm); await _controller.EvaluateOfficeForStudentsPage(command); ApplyApiClient.Verify(x => x.SubmitGatewayPageAnswer(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), null), Times.Never); }
public async Task office_for_students_is_returned() { var applicationId = Guid.NewGuid(); var expectedViewModel = new OfficeForStudentsViewModel(); _orchestrator.Setup(x => x.GetOfficeForStudentsViewModel(It.Is <GetOfficeForStudentsRequest>(y => y.ApplicationId == applicationId && y.UserName == Username))).ReturnsAsync(expectedViewModel); var result = await _controller.OfficeForStudents(applicationId); Assert.AreSame(expectedViewModel, result.Model); }
public async Task <OfficeForStudentsViewModel> GetOfficeForStudentsViewModel(GetOfficeForStudentsRequest request) { _logger.LogInformation($"Retrieving office for students details for application {request.ApplicationId}"); var model = new OfficeForStudentsViewModel(); await model.PopulatePageCommonDetails(_applyApiClient, request.ApplicationId, GatewaySequences.ExperienceAndAccreditationChecks, GatewayPageIds.OfficeForStudents, request.UserId, request.UserName, RoatpGatewayConstants.Captions.ExperienceAndAccreditation, RoatpGatewayConstants.Headings.OfficeForStudents, NoSelectionErrorMessages.Errors[GatewayPageIds.OfficeForStudents]); model.IsOrganisationFundedByOfficeForStudents = await _experienceAndAccreditationApiClient.GetOfficeForStudents(request.ApplicationId) == "Yes"; return(model); }