public void check_ofsted_details_are_returned() { var ofstedDetails = new OfstedDetails { FullInspectionApprenticeshipGrade = "Pass", FullInspectionOverallEffectivenessGrade = "Fail", GradeWithinTheLast3Years = true, HasHadFullInspection = false, HasHadMonitoringVisit = true, HasHadShortInspectionWithinLast3Years = false, HasMaintainedFullGradeInShortInspection = true, HasMaintainedFundingSinceInspection = false, ReceivedFullInspectionGradeForApprenticeships = true, Has2MonitoringVisitsGradedInadequate = false, HasMonitoringVisitGradedInadequateInLast18Months = true }; ExperienceAndAccreditationApiClient.Setup(x => x.GetOfstedDetails(ApplicationId)).ReturnsAsync(ofstedDetails); var request = new GetOfstedDetailsRequest(ApplicationId, UserId, UserName); var response = Orchestrator.GetOfstedDetailsViewModel(request); var viewModel = response.Result; Assert.AreEqual(GatewayPageIds.Ofsted, viewModel.PageId); AssertCommonDetails(viewModel); Assert.AreEqual(ofstedDetails.FullInspectionApprenticeshipGrade, viewModel.FullInspectionApprenticeshipGrade); Assert.AreEqual(ofstedDetails.FullInspectionOverallEffectivenessGrade, viewModel.FullInspectionOverallEffectivenessGrade); Assert.AreEqual(ofstedDetails.GradeWithinTheLast3Years, viewModel.GradeWithinTheLast3Years); Assert.AreEqual(ofstedDetails.HasHadFullInspection, viewModel.HasHadFullInspection); Assert.AreEqual(ofstedDetails.HasHadMonitoringVisit, viewModel.HasHadMonitoringVisit); Assert.AreEqual(ofstedDetails.HasHadShortInspectionWithinLast3Years, viewModel.HasHadShortInspectionWithinLast3Years); Assert.AreEqual(ofstedDetails.HasMaintainedFullGradeInShortInspection, viewModel.HasMaintainedFullGradeInShortInspection); Assert.AreEqual(ofstedDetails.HasMaintainedFundingSinceInspection, viewModel.HasMaintainedFundingSinceInspection); Assert.AreEqual(ofstedDetails.ReceivedFullInspectionGradeForApprenticeships, viewModel.ReceivedFullInspectionGradeForApprenticeships); Assert.AreEqual(ofstedDetails.Has2MonitoringVisitsGradedInadequate, viewModel.Has2MonitoringVisitsGradedInadequate); Assert.AreEqual(ofstedDetails.HasMonitoringVisitGradedInadequateInLast18Months, viewModel.HasMonitoringVisitGradedInadequateInLast18Months); }
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); }