public void Then_The_PutUrl_Is_Correctly_Build(UpdateIncentiveApplicationRequestData data) { var actual = new UpdateIncentiveApplicationRequest { Data = data }; actual.PutUrl.Should().Be($"applications/{data.IncentiveApplicationId}"); actual.Data.Should().BeEquivalentTo(data); }
public async Task Then_The_InnerApi_Is_Called( UpdateIncentiveApplicationRequestData requestData, [Frozen] Mock <IEmployerIncentivesApiClient <EmployerIncentivesConfiguration> > client, ApplicationService sut) { await sut.Update(requestData); client.Verify(x => x.Put(It.Is <UpdateIncentiveApplicationRequest>( c => c.Data == requestData && c.PutUrl.Contains("application") && c.PutUrl.Contains(requestData.IncentiveApplicationId.ToString()) )), Times.Once); }
public async Task <Unit> Handle(SaveApprenticeshipDetailsCommand request, CancellationToken cancellationToken) { var apprenticeshipIds = request.ApprenticeshipDetailsRequest.ApprenticeshipDetails.Select(x => x.ApprenticeId); var apprenticeships = await _commitmentsService.GetApprenticeshipDetails(request.ApprenticeshipDetailsRequest.AccountId, apprenticeshipIds); var apprenticeshipDetails = new UpdateIncentiveApplicationRequestData { IncentiveApplicationId = request.ApprenticeshipDetailsRequest.ApplicationId, AccountId = request.ApprenticeshipDetailsRequest.AccountId, Apprenticeships = apprenticeships.Select(x => (IncentiveClaimApprenticeshipDto)x).ToArray() }; foreach (var apprenticeship in apprenticeshipDetails.Apprenticeships) { var employmentDetails = request.ApprenticeshipDetailsRequest.ApprenticeshipDetails.FirstOrDefault(x => x.ApprenticeId == apprenticeship.ApprenticeshipId); apprenticeship.EmploymentStartDate = employmentDetails.EmploymentStartDate; } await _applicationService.Update(apprenticeshipDetails); return(Unit.Value); }
public Task Update(UpdateIncentiveApplicationRequestData requestData) { return(_client.Put(new UpdateIncentiveApplicationRequest { Data = requestData })); }