public WhenCallingDataLockRequestChangesTestsFixture() : base() { _request = _autoFixture.Create <DataLockRequestChangesRequest>(); _viewModel = _autoFixture.Create <DataLockRequestChangesViewModel>(); _mockMapper.Setup(m => m.Map <DataLockRequestChangesViewModel>(_request)) .ReturnsAsync(_viewModel); }
public DataLockRequestChangesRequestToViewModelMapperTestsFixture() { // Arrange AutoFixture = new Fixture(); _request = AutoFixture.Build <DataLockRequestChangesRequest>() .With(x => x.AccountHashedId, "123") .With(x => x.ApprenticeshipHashedId, "456") .Create(); _dataLockSummariesResponse = AutoFixture.Build <GetDataLockSummariesResponse>() .With(x => x.DataLocksWithCourseMismatch, DataLocksWithCourseMismatch) .With(x => x.DataLocksWithOnlyPriceMismatch, DataLocksWithOnlyPriceMismatch) .Create(); PriceEpisodes.Add(new PriceEpisode { FromDate = DateTime.Now.Date, ToDate = null, Cost = 1000.0M }); _priceEpisodesResponse = AutoFixture.Build <GetPriceEpisodesResponse>() .With(x => x.PriceEpisodes, PriceEpisodes) .Create(); TrainingProgrammes.Add(new TrainingProgramme { CourseCode = "111", ProgrammeType = ProgrammeType.Standard, Name = "Training 111" }); _allTrainingProgrammeResponse = AutoFixture.Build <GetAllTrainingProgrammesResponse>() .With(x => x.TrainingProgrammes, TrainingProgrammes) .Create(); _apprenticeshipResponse = AutoFixture.Build <GetApprenticeshipResponse>() .With(p => p.CourseCode, "111") .With(p => p.CourseName, "Training 111") .With(p => p.EndDate, DateTime.Now.Date.AddDays(100)) .Create(); _mockCommitmentsApiClient = new Mock <ICommitmentsApiClient>(); _mockCommitmentsApiClient.Setup(r => r.GetApprenticeshipDatalockSummariesStatus(It.IsAny <long>(), CancellationToken.None)) .ReturnsAsync(_dataLockSummariesResponse); _mockCommitmentsApiClient.Setup(c => c.GetPriceEpisodes(It.IsAny <long>(), CancellationToken.None)) .ReturnsAsync(_priceEpisodesResponse); _mockCommitmentsApiClient.Setup(c => c.GetApprenticeship(It.IsAny <long>(), CancellationToken.None)) .ReturnsAsync(_apprenticeshipResponse); _mockCommitmentsApiClient.Setup(t => t.GetAllTrainingProgrammes(It.IsAny <CancellationToken>())) .ReturnsAsync(_allTrainingProgrammeResponse); _mapper = new DataLockRequestChangesRequestToViewModelMapper(_mockCommitmentsApiClient.Object); }
public async Task <IActionResult> DataLockRequestChanges(DataLockRequestChangesRequest request) { var viewModel = await _modelMapper.Map <DataLockRequestChangesViewModel>(request); return(View(viewModel)); }