コード例 #1
0
        public async Task clarifying_ofsted_details_saves_evaluation_result()
        {
            var applicationId = Guid.NewGuid();
            var pageId        = GatewayPageIds.Ofsted;

            var vm = new OfstedDetailsViewModel
            {
                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.ClarifyOfstedDetailsPage(command);

            ApplyApiClient.Verify(x => x.SubmitGatewayPageAnswerPostClarification(applicationId, pageId, vm.Status, UserId, Username, vm.OptionPassText, ClarificationAnswer));
        }
コード例 #2
0
        public async Task ofsted_details_are_returned()
        {
            var applicationId     = Guid.NewGuid();
            var expectedViewModel = new OfstedDetailsViewModel();

            _orchestrator.Setup(x => x.GetOfstedDetailsViewModel(It.Is <GetOfstedDetailsRequest>(y => y.ApplicationId == applicationId && y.UserName == Username))).ReturnsAsync(expectedViewModel);

            var result = await _controller.OfstedDetails(applicationId);

            Assert.AreSame(expectedViewModel, result.Model);
        }
コード例 #3
0
        public async Task <OfstedDetailsViewModel> GetOfstedDetailsViewModel(GetOfstedDetailsRequest request)
        {
            _logger.LogInformation($"Retrieving Ofsted details for application {request.ApplicationId}");

            var model = new OfstedDetailsViewModel();
            await model.PopulatePageCommonDetails(_applyApiClient, request.ApplicationId, GatewaySequences.ExperienceAndAccreditationChecks, GatewayPageIds.Ofsted, request.UserId, request.UserName, RoatpGatewayConstants.Captions.ExperienceAndAccreditation, RoatpGatewayConstants.Headings.Ofsted, NoSelectionErrorMessages.Errors[GatewayPageIds.Ofsted]);

            var ofstedDetails = await _experienceAndAccreditationApiClient.GetOfstedDetails(request.ApplicationId);

            model.FullInspectionApprenticeshipGrade       = ofstedDetails.FullInspectionApprenticeshipGrade;
            model.FullInspectionOverallEffectivenessGrade = ofstedDetails.FullInspectionOverallEffectivenessGrade;
            model.GradeWithinTheLast3Years = ofstedDetails.GradeWithinTheLast3Years;
            model.HasHadFullInspection     = ofstedDetails.HasHadFullInspection;
            model.HasHadMonitoringVisit    = ofstedDetails.HasHadMonitoringVisit;
            model.HasHadShortInspectionWithinLast3Years            = ofstedDetails.HasHadShortInspectionWithinLast3Years;
            model.HasMaintainedFullGradeInShortInspection          = ofstedDetails.HasMaintainedFullGradeInShortInspection;
            model.HasMaintainedFundingSinceInspection              = ofstedDetails.HasMaintainedFundingSinceInspection;
            model.ReceivedFullInspectionGradeForApprenticeships    = ofstedDetails.ReceivedFullInspectionGradeForApprenticeships;
            model.Has2MonitoringVisitsGradedInadequate             = ofstedDetails.Has2MonitoringVisitsGradedInadequate;
            model.HasMonitoringVisitGradedInadequateInLast18Months =
                ofstedDetails.HasMonitoringVisitGradedInadequateInLast18Months;
            return(model);
        }
コード例 #4
0
        public async Task clarifying_ofsted_details_without_required_fields_does_not_save()
        {
            var applicationId = Guid.NewGuid();
            var pageId        = GatewayPageIds.Ofsted;

            var vm = new OfstedDetailsViewModel()
            {
                Status              = SectionReviewStatus.Fail,
                SourcesCheckedOn    = DateTime.Now,
                ErrorMessages       = new List <ValidationErrorDetail>(),
                ApplicationId       = applicationId,
                PageId              = pageId,
                ClarificationAnswer = ClarificationAnswer
            };

            var command = new SubmitGatewayPageAnswerCommand(vm);

            GatewayValidator.Setup(v => v.ValidateClarification(command))
            .ReturnsAsync(new ValidationResponse
            {
                Errors = new List <ValidationErrorDetail>
                {
                    new ValidationErrorDetail {
                        Field = "OptionFail", ErrorMessage = "needs text"
                    }
                }
            }
                          );

            _orchestrator.Setup(x => x.GetOfstedDetailsViewModel(It.Is <GetOfstedDetailsRequest>(y => y.ApplicationId == vm.ApplicationId &&
                                                                                                 y.UserName == Username))).ReturnsAsync(vm);

            await _controller.ClarifyOfstedDetailsPage(command);

            ApplyApiClient.Verify(x => x.SubmitGatewayPageAnswer(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Never);
        }