Exemple #1
0
        public void Arrange()
        {
            _fixture              = new Fixture();
            _accountId            = _fixture.Create <string>();
            _accountLegalEntityId = _fixture.Create <string>();

            _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 <IApprenticeshipIncentiveService>();
            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);

            _configuration = new Mock <IOptions <ExternalLinksConfiguration> >();
            var config = new ExternalLinksConfiguration {
                ManageApprenticeshipSiteUrl = "https://manage-apprentices.com"
            };

            _configuration.Setup(x => x.Value).Returns(config);

            _sut = new Web.Controllers.HubController(_legalEntitiesService.Object, _applicationService.Object, _configuration.Object);
        }
Exemple #2
0
        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();
        }