public async Task MapsAllLinksAfterMandateImportHasBeenSubmitted() { // given var subject = new MandateImportEntriesClient(_clientConfiguration); var mandateImport = await _resourceFactory.CreateMandateImport(); var mandateImportEntry = await _resourceFactory.CreateMandateImportEntryFor(mandateImport, "first-record"); var mandateImportsClient = new MandateImportsClient(_clientConfiguration); await mandateImportsClient.SubmitAsync(mandateImport.Id); var request = new GetMandateImportEntriesRequest { MandateImport = mandateImport.Id }; // when var result = (await subject.GetPageAsync(request)).Items.ToList(); // then Assert.That(result.Any(), Is.True); Assert.That(result[0].Links, Is.Not.Null); Assert.That(result[0].Links.Customer, Is.Not.Null); Assert.That(result[0].Links.CustomerBankAccount, Is.Not.Null); Assert.That(result[0].Links.Mandate, Is.Not.Null); Assert.That(result[0].Links.MandateImport, Is.Not.Null.And.EqualTo(mandateImport.Id)); }
public void SubmitIdIsNullOrWhiteSpaceThrows(string id) { // given var subject = new MandateImportsClient(_clientConfiguration); // when AsyncTestDelegate test = () => subject.SubmitAsync(id); // then var ex = Assert.ThrowsAsync <ArgumentException>(test); Assert.That(ex.ParamName, Is.EqualTo(nameof(id))); }
public async Task CallsSubmitMandateImportEndpoint() { // given var subject = new MandateImportsClient(_clientConfiguration); var id = "IM12345678"; // when await subject.SubmitAsync(id); // then _httpTest .ShouldHaveCalled("https://api.gocardless.com/mandate_imports/IM12345678/actions/submit") .WithVerb(HttpMethod.Post); }
public async Task SubmitsMandateImport() { // given var subject = new MandateImportsClient(_clientConfiguration); var mandateImport = await _resourceFactory.CreateMandateImport(); // when var result = await subject.SubmitAsync(mandateImport.Id); // then Assert.That(result.Item, Is.Not.Null); Assert.That(result.Item.Id, Is.Not.Null.And.EqualTo(mandateImport.Id)); Assert.That(result.Item.CreatedAt, Is.Not.Null.And.EqualTo(mandateImport.CreatedAt)); Assert.That(result.Item.Scheme, Is.Not.Null.And.EqualTo(mandateImport.Scheme)); Assert.That(result.Item.Status, Is.Not.Null.And.Not.EqualTo(mandateImport.Status)); }