public WhenPostingTheConfirmDetailsAndSendRequestPageTestsFixture() : base() { _viewModel = _autoFixture.Build <ConfirmDetailsAndSendViewModel>() .With(x => x.NewStartDate, new DateTime(2020, 1, 1)) .With(x => x.NewEndDate, new DateTime(2022, 1, 1)) .Create(); }
public WhenRequestingConfirmAndSendRequestPageTestsFixture() : base() { _request = _autoFixture.Create <ChangeOfProviderRequest>(); _viewModel = _autoFixture.Create <ConfirmDetailsAndSendViewModel>(); _mockMapper.Setup(m => m.Map <ConfirmDetailsAndSendViewModel>(_request)) .ReturnsAsync(_viewModel); }
public async Task Setup() { var fixture = new Fixture(); _viewModel = fixture.Build <ConfirmDetailsAndSendViewModel>() .With(x => x.NewStartDate, DateTime.Now) .With(x => x.NewEndDate, DateTime.Now.AddYears(1)) .Create(); var mapper = new EmployerLedCreateChangeOfProviderRequestMapper(); _result = await mapper.Map(_viewModel); }
public async Task <IActionResult> ConfirmDetailsAndSendRequestPage(ConfirmDetailsAndSendViewModel viewModel) { try { var apiRequest = await _modelMapper.Map <CreateChangeOfPartyRequestRequest>(viewModel); await _commitmentsApiClient.CreateChangeOfPartyRequest(viewModel.ApprenticeshipId, apiRequest); return(RedirectToRoute(RouteNames.ChangeProviderRequestedConfirmation, new { viewModel.AccountHashedId, viewModel.ApprenticeshipHashedId, viewModel.ProviderId, viewModel.StoppedDuringCoP })); } catch (Exception ex) { _logger.LogError($"Failed '{nameof(ApprenticeController)}-{nameof(ConfirmDetailsAndSendRequestPage)}': {nameof(ex.Message)}='{ex.Message}', {nameof(ex.StackTrace)}='{ex.StackTrace}'"); return(RedirectToAction("Error", "Error")); } }