public void Then_The_PatchUrl_Is_Correctly_Built(BlockAccountLegalEntityForPaymentsRequest data) { var actual = new PatchVendorBlockRequest(data); actual.PatchUrl.Should().Be($"/blockedpayments"); actual.Data.Should().BeEquivalentTo(data); }
public async Task BlockAccountLegalEntitiesForPayments(BlockAccountLegalEntityForPaymentsRequest blockRequest) { var apiRequest = new PatchVendorBlockRequest(blockRequest); var response = await _client.PatchWithResponseCode(apiRequest); response.EnsureSuccessStatusCode(); }
public void GivenTheCallerWantsToBlockAccountLegalEntitiesForPayment() { _request = _fixture.Build <BlockAccountLegalEntityForPaymentsRequest>() .With(x => x.ServiceRequest, _fixture.Create <ServiceRequest>()) .With(x => x.VendorBlocks, new List <VendorBlock> { _fixture.Build <VendorBlock>() .With(x => x.VendorBlockEndDate, DateTime.Today.AddMonths(1)) .Create(), _fixture.Build <VendorBlock>() .With(x => x.VendorBlockEndDate, DateTime.Today.AddMonths(2)) .Create() }) .Create(); }
public async Task Then_The_Api_Is_Called_With_The_Vendor_Block_Request( BlockAccountLegalEntityForPaymentsRequest request, [Frozen] Mock <IEmployerIncentivesApiClient <EmployerIncentivesConfiguration> > client, LegalEntitiesService service ) { client.Setup(x => x.PatchWithResponseCode(It.Is <PatchVendorBlockRequest>( c => c.PatchUrl.Contains("blockedpayments") ))).ReturnsAsync(new ApiResponse <string>("", HttpStatusCode.NoContent, "")); await service.BlockAccountLegalEntitiesForPayments(request); client.Verify(x => x.PatchWithResponseCode(It.Is <PatchVendorBlockRequest>( c => c.PatchUrl.Contains("blockedpayments") )), Times.Once); }
public async Task Then_Sends_Block_Request_To_Mediator( long accountId, BlockAccountLegalEntityForPaymentsRequest request, [Frozen] Mock <IMediator> mockMediator, [Greedy] AccountController controller) { var controllerResult = await controller.BlockAccountLegalEntityForPayments(request) as NoContentResult; Assert.IsNotNull(controllerResult); controllerResult.StatusCode.Should().Be((int)HttpStatusCode.NoContent); mockMediator .Verify(mediator => mediator.Send( It.Is <BlockAccountLegalEntityForPaymentsCommand>(c => c.VendorBlockRequest == request), It.IsAny <CancellationToken>())); }
public async Task <IActionResult> BlockAccountLegalEntityForPayments(BlockAccountLegalEntityForPaymentsRequest request) { await _mediator.Send(new BlockAccountLegalEntityForPaymentsCommand(request)); return(NoContent()); }
public BlockAccountLegalEntityForPaymentsCommand(BlockAccountLegalEntityForPaymentsRequest vendorBlockRequest) { VendorBlockRequest = vendorBlockRequest; }