private TrainingProviderOrchestrator GetTrainingProviderOrchestrator(Vacancy vacancy) { var mockClient = new Mock <IEmployerVacancyClient>(); var mockTrainingProviderService = new Mock <ITrainingProviderService>(); mockTrainingProviderService.Setup(t => t.GetProviderAsync(88888888)) .ReturnsAsync(new TrainingProvider { Ukprn = 88888888 }); var mockRecruitClient = new Mock <IRecruitVacancyClient>(); mockRecruitClient.Setup(c => c.GetVacancyAsync(VacancyId)).ReturnsAsync(vacancy); var mockTrainingProviderSummaryProvider = new Mock <ITrainingProviderSummaryProvider>(); var mrEggTrainingProvider = new TrainingProviderSummary { ProviderName = "MR EGG", Ukprn = 88888888 }; var mrsEggTrainingProvider = new TrainingProviderSummary { ProviderName = "MRS EGG", Ukprn = 88888889 }; mockTrainingProviderSummaryProvider.Setup(p => p.FindAllAsync()).ReturnsAsync(new List <TrainingProviderSummary> { mrEggTrainingProvider, mrsEggTrainingProvider }); mockTrainingProviderSummaryProvider.Setup(p => p.GetAsync(88888888)) .ReturnsAsync(mrEggTrainingProvider); mockTrainingProviderSummaryProvider.Setup(p => p.GetAsync(88888889)) .ReturnsAsync(mrsEggTrainingProvider); mockRecruitClient.Setup(c => c.Validate(It.IsAny <Vacancy>(), VacancyRuleSet.TrainingProvider)) .Returns(new EntityValidationResult()); var mockLog = new Mock <ILogger <TrainingProviderOrchestrator> >(); var mockReview = new Mock <IReviewSummaryService>(); return(new TrainingProviderOrchestrator(mockClient.Object, mockRecruitClient.Object, mockLog.Object, mockReview.Object, mockTrainingProviderSummaryProvider.Object, mockTrainingProviderService.Object)); }
private void ManageTempData(TrainingProviderSummary provider, IApprenticeshipProgramme programme) { if (provider != null) { TempData[TempDataKeys.ReferredUkprn] = provider.Ukprn; } else { TempData.Remove(TempDataKeys.ReferredUkprn); } if (programme != null) { TempData[TempDataKeys.ReferredProgrammeId] = programme.Id; } else { TempData.Remove(TempDataKeys.ReferredProgrammeId); } }
public TrainingProviderOrchestratorTestsFixture() { MockClient = new Mock <IEmployerVacancyClient>(); MockRecruitVacancyClient = new Mock <IRecruitVacancyClient>(); MockTrainingProviderSummaryProvider = new Mock <ITrainingProviderSummaryProvider>(); MockTrainingProviderService = new Mock <ITrainingProviderService>(); User = VacancyOrchestratorTestData.GetVacancyUser(); TrainingProviderOne = new TrainingProvider { Ukprn = 88888888 }; TrainingProviderTwo = new TrainingProvider { Ukprn = 88888889 }; TrainingProviderSummaryOne = new TrainingProviderSummary { ProviderName = "First Training Provider", Ukprn = TrainingProviderOne.Ukprn.Value }; TrainingProviderSummaryTwo = new TrainingProviderSummary { ProviderName = "Second Training Provider", Ukprn = TrainingProviderTwo.Ukprn.Value }; }