public WhenRequestingViewApprenticeshipUpdatesTestsixture() : base() { Request = new ViewApprenticeshipUpdatesRequest { ApprenticeshipId = 1, AccountId = 1 }; _controller.TempData = new TempDataDictionary(Mock.Of <HttpContext>(), Mock.Of <ITempDataProvider>()); }
public ViewApprenticeshipUpdatesRequestToViewModelMapperTestsFixture() { var autoFixture = new Fixture(); autoFixture.Customizations.Add(new DateTimeSpecimenBuilder()); CommitmentApiClient = new Mock <ICommitmentsApiClient>(); Source = new ViewApprenticeshipUpdatesRequest { ApprenticeshipId = ApprenticeshipId, ProviderId = 22, ApprenticeshipHashedId = "XXX" }; GetApprenticeshipResponse = autoFixture.Create <GetApprenticeshipResponse>(); GetApprenticeshipResponse.Id = ApprenticeshipId; autoFixture.RepeatCount = 1; GetApprenticeshipUpdatesResponses = autoFixture.Create <GetApprenticeshipUpdatesResponse>(); ApprenticeshipUpdate = GetApprenticeshipUpdatesResponses.ApprenticeshipUpdates.First(); GetTrainingProgrammeResponse = autoFixture.Create <GetTrainingProgrammeResponse>(); var priceEpisode = new GetPriceEpisodesResponse { PriceEpisodes = new List <GetPriceEpisodesResponse.PriceEpisode>() { new GetPriceEpisodesResponse.PriceEpisode { FromDate = DateTime.UtcNow.AddDays(-10), ToDate = null, Cost = 100 } } }; CommitmentApiClient.Setup(x => x.GetApprenticeship(ApprenticeshipId, It.IsAny <CancellationToken>())).Returns(() => Task.FromResult(GetApprenticeshipResponse)); CommitmentApiClient.Setup(x => x.GetApprenticeshipUpdates(ApprenticeshipId, It.IsAny <GetApprenticeshipUpdatesRequest>(), It.IsAny <CancellationToken>())).Returns(() => Task.FromResult(GetApprenticeshipUpdatesResponses)); CommitmentApiClient.Setup(x => x.GetPriceEpisodes(ApprenticeshipId, It.IsAny <CancellationToken>())).Returns(() => Task.FromResult(priceEpisode)); CommitmentApiClient.Setup(x => x.GetTrainingProgramme(It.IsAny <string>(), It.IsAny <CancellationToken>())).Returns(() => Task.FromResult(GetTrainingProgrammeResponse)); Mapper = new ViewApprenticeshipUpdatesRequestToViewModelMapper(CommitmentApiClient.Object); }
public async Task <IActionResult> ViewApprenticeshipUpdates(ViewApprenticeshipUpdatesRequest request) { var viewModel = await _modelMapper.Map <ViewApprenticeshipUpdatesViewModel>(request); return(View(viewModel)); }