public void GetCreditorsRequestIsNullThrows() { // given var subject = new CreditorsClient(_clientConfiguration); GetCreditorsRequest request = null; // when AsyncTestDelegate test = () => subject.GetPageAsync(request); // then var ex = Assert.ThrowsAsync <ArgumentNullException>(test); Assert.That(ex.ParamName, Is.EqualTo(nameof(request))); }
public async Task MapsPagingProperties() { // given var subject = new CreditorsClient(_clientConfiguration); var request = new GetCreditorsRequest { Limit = 1 }; // when var result = await subject.GetPageAsync(request); // then Assert.That(result.Items.Count(), Is.EqualTo(request.Limit)); Assert.That(result.Meta.Limit, Is.EqualTo(request.Limit)); Assert.That(result.Meta.Cursors.Before, Is.Null); Assert.That(result.Meta.Cursors.After, Is.Null); }
public async Task CallsGetCreditorsEndpointUsingRequest() { // given var subject = new CreditorsClient(_clientConfiguration); var request = new GetCreditorsRequest { Before = "before test", After = "after test", Limit = 5 }; // when await subject.GetPageAsync(request); // then _httpTest .ShouldHaveCalled("https://api.gocardless.com/creditors?before=before%20test&after=after%20test&limit=5") .WithVerb(HttpMethod.Get); }