public void RetryPaymentRequestIsNullThrows() { // given var subject = new PaymentsClient(_clientConfiguration); RetryPaymentRequest request = null; // when AsyncTestDelegate test = () => subject.RetryAsync(request); // then var ex = Assert.ThrowsAsync <ArgumentNullException>(test); Assert.That(ex.ParamName, Is.EqualTo(nameof(request))); }
public async Task CallsRetryPaymentEndpoint() { // given var subject = new PaymentsClient(_clientConfiguration); var request = new RetryPaymentRequest { Id = "PM12345678" }; // when await subject.RetryAsync(request); // then _httpTest .ShouldHaveCalled("https://api.gocardless.com/payments/PM12345678/actions/retry") .WithVerb(HttpMethod.Post); }
public void RetryPaymentRequestIdIsNullOrWhiteSpaceThrows(string id) { // given var subject = new PaymentsClient(_clientConfiguration); var request = new RetryPaymentRequest { Id = id }; // when AsyncTestDelegate test = () => subject.RetryAsync(request); // then var ex = Assert.ThrowsAsync <ArgumentException>(test); Assert.That(ex.ParamName, Is.EqualTo(nameof(request.Id))); }
public async Task RetriesPayment() { // given var payment = await _resourceFactory.CreatePaymentFor(_mandate); var request = new RetryPaymentRequest { Id = payment.Id }; var subject = new PaymentsClient(_clientConfiguration); // when var result = await subject.RetryAsync(request); var actual = result.Item; // then Assert.That(actual, Is.Not.Null); Assert.That(actual.Id, Is.EqualTo(payment.Id)); Assert.That(actual.Metadata, Is.EqualTo(request.Metadata)); }