public void Arrange()
        {
            _applicationService          = new Mock <IApplicationService>();
            _legalEntitiesService        = new Mock <ILegalEntitiesService>();
            _linksConfiguration          = new Mock <IOptions <ExternalLinksConfiguration> >();
            _manageApprenticeshipSiteUrl = $"http://{Guid.NewGuid()}";

            _linksConfiguration.Setup(m => m.Value).Returns(new ExternalLinksConfiguration
            {
                ManageApprenticeshipSiteUrl = _manageApprenticeshipSiteUrl
            });

            _sut = new Web.Controllers.PaymentsController(_applicationService.Object, _legalEntitiesService.Object, _linksConfiguration.Object)
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = new DefaultHttpContext()
                }
            };
            _fixture              = new Fixture();
            _accountId            = _fixture.Create <string>();
            _accountLegalEntityId = _fixture.Create <string>();
            _sortOrder            = ApplicationsSortOrder.Ascending;
            _sortField            = ApplicationsSortField.ApprenticeName;
        }
Esempio n. 2
0
        public void Arrange()
        {
            _applicationService   = new Mock <IApplicationService>();
            _legalEntitiesService = new Mock <ILegalEntitiesService>();
            _linksConfiguration   = new Mock <IOptions <ExternalLinksConfiguration> >();
            _fixture           = new Fixture();
            _accountId         = _fixture.Create <string>();
            _manageAccountsUrl = _fixture.Create <string>();

            _sut = new Web.Controllers.PaymentsController(_applicationService.Object, _legalEntitiesService.Object, _linksConfiguration.Object);
        }
        public async Task Then_employment_check_status_message_is_not_shown_if_employment_check_result_not_set()
        {
            // Arrange
            var applications = new List <ApprenticeApplicationModel>();

            applications.Add(
                _fixture.Build <ApprenticeApplicationModel>()
                .With(p => p.FirstPaymentStatus, _fixture.Build <PaymentStatusModel>().Without(p => p.EmploymentCheckPassed).Create())
                .With(p => p.SecondPaymentStatus, _fixture.Build <PaymentStatusModel>().Without(p => p.EmploymentCheckPassed).Create())
                .Create());

            var getApplicationsResponse = new GetApplicationsModel {
                ApprenticeApplications = applications
            };

            _applicationService.Setup(x => x.GetList(_accountId, _accountLegalEntityId)).ReturnsAsync(getApplicationsResponse);

            var legalEntities = new List <LegalEntityModel> {
                new LegalEntityModel {
                    AccountId = _accountId, AccountLegalEntityId = _accountLegalEntityId
                }
            };

            _legalEntitiesService.Setup(x => x.Get(_accountId)).ReturnsAsync(legalEntities);

            _sut = new Web.Controllers.PaymentsController(_applicationService.Object, _legalEntitiesService.Object, _linksConfiguration.Object)
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = new DefaultHttpContext()
                }
            };

            // Act
            var result = await _sut.ListPaymentsForLegalEntity(_accountId, _accountLegalEntityId, _sortOrder, _sortField) as ViewResult;

            // Assert
            var viewModel = result.Model as ViewApplicationsViewModel;

            viewModel.Should().NotBeNull();
            viewModel.Applications.First().FirstPaymentStatus.EmploymentCheckPassed.HasValue.Should().BeFalse();
            viewModel.Applications.First().SecondPaymentStatus.EmploymentCheckPassed.HasValue.Should().BeFalse();
        }
 public void Arrange()
 {
     _apprenticeshipIncentiveService = new Mock <IApprenticeshipIncentiveService>();
     _legalEntitiesService           = new Mock <ILegalEntitiesService>();
     _hashingService = new Mock <IHashingService>();
     _configuration  = new Mock <IOptions <ExternalLinksConfiguration> >();
     _sut            = new Web.Controllers.PaymentsController(_apprenticeshipIncentiveService.Object, _legalEntitiesService.Object, _hashingService.Object, _configuration.Object)
     {
         ControllerContext = new ControllerContext()
         {
             HttpContext = new DefaultHttpContext()
         }
     };
     _fixture              = new Fixture();
     _accountId            = _fixture.Create <string>();
     _accountLegalEntityId = _fixture.Create <string>();
     _sortOrder            = ApplicationsSortOrder.Ascending;
     _sortField            = ApplicationsSortField.ApprenticeName;
     _hashingService.Setup(x => x.HashValue(It.IsAny <long>())).Returns(_fixture.Create <string>());
 }