public HubController(ILegalEntitiesService legalEntitiesService, IApplicationService applicationService, IOptions <ExternalLinksConfiguration> externalLinksConfiguration, IOptions <WebConfigurationOptions> webConfiguration) { _legalEntitiesService = legalEntitiesService; _applicationService = applicationService; _externalLinksConfiguration = externalLinksConfiguration.Value; _webConfiguration = webConfiguration.Value; }
private void Initialise() { var webOptions = new WebConfigurationOptions(); _configuration.GetSection(WebConfigurationOptions.EmployerIncentivesWebConfiguration).Bind(webOptions); DateTime.TryParse(webOptions.ApplicationShutterPageDate, out _applyFromDate); _isInitialised = true; }
public VerificationService(IBankingDetailsService bankingDetailsService, IDataEncryptionService dataEncryptionService, IHashingService hashingService, ILegalEntitiesService legalEntitiesService, WebConfigurationOptions configuration) { _bankingDetailsService = bankingDetailsService; _dataEncryptionService = dataEncryptionService; _hashingService = hashingService; _legalEntitiesService = legalEntitiesService; _configuration = configuration; }
public void Arrange() { _fixture = new Fixture(); _accountId = _fixture.Create <string>(); _accountLegalEntityId = _fixture.Create <string>(); _manageApprenticeshipSiteUrl = $"http://{Guid.NewGuid()}"; _legalEntitiesService = new Mock <ILegalEntitiesService>(); _legalEntities = _fixture.CreateMany <LegalEntityModel>(1).ToList(); _legalEntities[0].AccountId = _accountId; _legalEntities[0].AccountLegalEntityId = _accountLegalEntityId; _legalEntitiesService.Setup(x => x.Get(_accountId)).ReturnsAsync(_legalEntities); _applicationService = new Mock <IApplicationService>(); var applicationsResponse = new GetApplicationsModel { BankDetailsStatus = BankDetailsStatus.Completed, ApprenticeApplications = _fixture.CreateMany <ApprenticeApplicationModel>(5).ToList(), FirstSubmittedApplicationId = Guid.NewGuid() }; _applicationService.Setup(x => x.GetList(_accountId, _accountLegalEntityId)).ReturnsAsync(applicationsResponse); _externalLinksConfiguration = new Mock <IOptions <ExternalLinksConfiguration> >(); var linksConfig = new ExternalLinksConfiguration { ManageApprenticeshipSiteUrl = _manageApprenticeshipSiteUrl }; _externalLinksConfiguration.Setup(x => x.Value).Returns(linksConfig); _webConfiguration = new Mock <IOptions <WebConfigurationOptions> >(); var webConfig = new WebConfigurationOptions(); _webConfiguration.Setup(x => x.Value).Returns(webConfig); _sut = new Web.Controllers.HubController(_legalEntitiesService.Object, _applicationService.Object, _externalLinksConfiguration.Object, _webConfiguration.Object); }
public async Task Then_the_bank_details_banner_content_should_be_not_shown_if_none_supplied_and_the_cut_off_date_has_elapsed_and_no_applications_submitted(BankDetailsStatus bankDetailsStatus) { // Arrange var webConfig = new WebConfigurationOptions { ApplicationShutterPageDate = DateTime.Now.ToString() }; _webConfiguration.Setup(x => x.Value).Returns(webConfig); var getApplicationsResponse = new GetApplicationsModel { ApprenticeApplications = new List <ApprenticeApplicationModel>(), FirstSubmittedApplicationId = null, BankDetailsStatus = bankDetailsStatus }; _applicationService.Setup(x => x.GetList(_accountId, _accountLegalEntityId)).ReturnsAsync(getApplicationsResponse); _sut = new Web.Controllers.HubController(_legalEntitiesService.Object, _applicationService.Object, _externalLinksConfiguration.Object, _webConfiguration.Object); // Act var viewResult = await _sut.Index(_accountId, _accountLegalEntityId) as ViewResult; // Assert var viewModel = viewResult.Model as HubPageViewModel; viewModel.ShowBankDetailsRequired.Should().BeFalse(); }