Exemplo n.º 1
0
 /// <inheritdoc />
 public async Task DeleteTransactionAsync(
     string transactionId,
     DeleteTransactionOptions options    = null,
     CancellationToken cancellationToken = default)
 {
     await retryPolicy
     .ExecuteAsync(
         ct => client.DeleteTransactionAsync(
             transactionId,
             options,
             ct),
         cancellationToken);
 }
        public async Task when_a_DeleteTransaction_is_called_then_we_should_have_called_the_transaction_delete_once()
        {
            var mockHttp = new MockHttpMessageHandler();

            mockHttp
            .Expect(HttpMethod.Delete, "http://localhost/api/transaction/transaction Id")
            .Respond(HttpStatusCode.OK, new StringContent(APIResponses.DeleteTransaction));

            using (var httpClient = mockHttp.ToHttpClient()) {
                var signhostApiClient = new SignHostApiClient(settings, httpClient);

                await signhostApiClient.DeleteTransactionAsync("transaction Id");
            }

            mockHttp.VerifyNoOutstandingExpectation();
        }
        public async Task when_a_DeleteTransaction_with_notification_is_called_then_we_should_have_called_the_transaction_delete_once()
        {
            var mockHttp = new MockHttpMessageHandler();

            mockHttp
            .Expect(HttpMethod.Delete, "http://localhost/api/transaction/transaction Id")
            .WithHeaders("Content-Type", "application/json")
            //.With(matcher => matcher.Content.ToString().Contains("'SendNotifications': true"))
            .Respond(HttpStatusCode.OK, new StringContent(APIResponses.DeleteTransaction));

            using (var httpClient = mockHttp.ToHttpClient()) {
                var signhostApiClient = new SignHostApiClient(settings, httpClient);

                await signhostApiClient.DeleteTransactionAsync(
                    "transaction Id",
                    new DeleteTransactionOptions { SendNotifications = true });
            }

            mockHttp.VerifyNoOutstandingExpectation();
        }