public void ThenApprenticeshipHashedIdIsValidated(string apprenticeshipHashedId, bool expectedValid) { var model = new StartDateRequest { ApprenticeshipHashedId = apprenticeshipHashedId }; AssertValidationResult(request => request.ApprenticeshipHashedId, model, expectedValid); }
public void ThenAccountLegalEntityIdIsValidated(long accountLegalEntityId, bool expectedValid) { var model = new StartDateRequest { AccountLegalEntityId = accountLegalEntityId }; AssertValidationResult(request => request.AccountLegalEntityId, model, expectedValid); }
public void ThenEmployerAccountLegalEntityPublicHashedIdIsValidated(string employerAccountLegalEntityPublicHashedId, bool expectedValid) { var model = new StartDateRequest { EmployerAccountLegalEntityPublicHashedId = employerAccountLegalEntityPublicHashedId }; AssertValidationResult(request => request.EmployerAccountLegalEntityPublicHashedId, model, expectedValid); }
public void ThenProviderIdIsValidated(long providerId, bool expectedValid) { var request = new StartDateRequest { ProviderId = providerId }; AssertValidationResult(x => x.ProviderId, request, expectedValid); }
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>()); }
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)); }
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); } }