Beispiel #1
0
 /// <inheritdoc />
 public async Task <ApiResponse <Transaction> > GetTransactionResponseAsync(
     string transactionId,
     CancellationToken cancellationToken = default)
 {
     return(await retryPolicy
            .ExecuteAsync(
                ct => client.GetTransactionResponseAsync(
                    transactionId,
                    ct),
                cancellationToken));
 }
        public void When_GetTransaction_is_called_and_gone_is_expected_we_should_get_a_transaction()
        {
            var mockHttp = new MockHttpMessageHandler();

            mockHttp
            .Expect(HttpMethod.Get, "http://localhost/api/transaction/transaction Id")
            .Respond(HttpStatusCode.Gone, new StringContent(APIResponses.GetTransaction));

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

                Func <Task> getTransaction = () => signhostApiClient.GetTransactionResponseAsync("transaction Id");
                getTransaction.Should().NotThrow();
            }

            mockHttp.VerifyNoOutstandingExpectation();
        }