예제 #1
0
        public void ThenApprenticeshipHashedIdIsValidated(string apprenticeshipHashedId, bool expectedValid)
        {
            var model = new StartDateRequest {
                ApprenticeshipHashedId = apprenticeshipHashedId
            };

            AssertValidationResult(request => request.ApprenticeshipHashedId, model, expectedValid);
        }
예제 #2
0
        public void ThenAccountLegalEntityIdIsValidated(long accountLegalEntityId, bool expectedValid)
        {
            var model = new StartDateRequest {
                AccountLegalEntityId = accountLegalEntityId
            };

            AssertValidationResult(request => request.AccountLegalEntityId, model, expectedValid);
        }
예제 #3
0
        public void ThenEmployerAccountLegalEntityPublicHashedIdIsValidated(string employerAccountLegalEntityPublicHashedId, bool expectedValid)
        {
            var model = new StartDateRequest {
                EmployerAccountLegalEntityPublicHashedId = employerAccountLegalEntityPublicHashedId
            };

            AssertValidationResult(request => request.EmployerAccountLegalEntityPublicHashedId, model, expectedValid);
        }
예제 #4
0
        public void ThenProviderIdIsValidated(long providerId, bool expectedValid)
        {
            var request = new StartDateRequest {
                ProviderId = providerId
            };

            AssertValidationResult(x => x.ProviderId, request, expectedValid);
        }
예제 #5
0
        public GetStartDateFixture()
        {
            _request = new StartDateRequest
            {
                ProviderId = 2342,
                EmployerAccountLegalEntityPublicHashedId = "AB34CDS",
                ApprenticeshipHashedId = "KG34DF989"
            };
            _viewModel = new StartDateViewModel();
            _cookieStorageServiceMock = new Mock <ICookieStorageService <IndexRequest> >();
            _modelMapperMock          = new Mock <IModelMapper>();
            _modelMapperMock
            .Setup(x => x.Map <StartDateViewModel>(_request))
            .ReturnsAsync(_viewModel);

            _sut = new ApprenticeController(_modelMapperMock.Object, _cookieStorageServiceMock.Object, Mock.Of <ICommitmentsApiClient>());
        }
예제 #6
0
 public StartDateViewModelMapperFixture()
 {
     Request = new StartDateRequest
     {
         ApprenticeshipHashedId = "SF45G54",
         ApprenticeshipId       = 234,
         ProviderId             = 645621,
         EmployerAccountLegalEntityPublicHashedId = "GD35SD35"
     };
     Response = new GetApprenticeshipResponse
     {
         StopDate     = DateTime.UtcNow.AddDays(-5),
         EmployerName = "TestName"
     };
     _commitmentsApiClientMock = new Mock <ICommitmentsApiClient>();
     _commitmentsApiClientMock
     .Setup(x => x.GetApprenticeship(Request.ApprenticeshipId, CancellationToken.None))
     .ReturnsAsync(Response);
     _sut = new StartDateViewModelMapper(_commitmentsApiClientMock.Object);
 }
        public async Task <IActionResult> StartDate(StartDateRequest request)
        {
            var viewModel = await _modelMapper.Map <StartDateViewModel>(request);

            return(View(viewModel));
        }
예제 #8
0
        private void AssertValidationResult <T>(Expression <Func <StartDateRequest, T> > property, StartDateRequest instance, bool expectedValid)
        {
            var validator = new StartDateRequestValidator();

            if (expectedValid)
            {
                validator.ShouldNotHaveValidationErrorFor(property, instance);
            }
            else
            {
                validator.ShouldHaveValidationErrorFor(property, instance);
            }
        }