public async Task CreatesAndDisablesConflictingCustomerBankAccountUsingBranchCode() { // given var customer = await _resourceFactory.CreateLocalCustomer(); var createRequest = new CreateCustomerBankAccountRequest { AccountHolderName = "API BANK ACCOUNT", AccountNumber = "55666666", BranchCode = "200000", CountryCode = "GB", Currency = "GBP", Links = new CustomerBankAccountLinks { Customer = customer.Id }, Metadata = new Dictionary <string, string> { ["Key1"] = "Value1", ["Key2"] = "Value2", ["Key3"] = "Value3", } }; var subject = new CustomerBankAccountsClient(_clientConfiguration); // when await subject.CreateAsync(createRequest); var creationResult = await subject.CreateAsync(createRequest); var disableRequest = new DisableCustomerBankAccountRequest { Id = creationResult.Item.Id }; var disabledResult = await subject.DisableAsync(disableRequest); // then Assert.That(creationResult.Item.Id, Is.Not.Null); Assert.That(creationResult.Item.AccountHolderName, Is.EqualTo(createRequest.AccountHolderName)); Assert.That(creationResult.Item.AccountNumberEnding, Is.Not.Null); Assert.That(creationResult.Item.BankName, Is.Not.Null); Assert.That(creationResult.Item.CountryCode, Is.EqualTo(createRequest.CountryCode)); Assert.That(creationResult.Item.Currency, Is.EqualTo(createRequest.Currency)); Assert.That(creationResult.Item.Metadata, Is.EqualTo(createRequest.Metadata)); Assert.That(creationResult.Item.Links.Customer, Is.EqualTo(createRequest.Links.Customer)); Assert.That(creationResult.Item.Enabled, Is.True); Assert.That(disabledResult.Item.Enabled, Is.False); }
public void DisableCustomerBankAccountRequestIsNullThrows() { // given var subject = new CustomerBankAccountsClient(_clientConfiguration); DisableCustomerBankAccountRequest request = null; // when AsyncTestDelegate test = () => subject.DisableAsync(request); // then var ex = Assert.ThrowsAsync <ArgumentNullException>(test); Assert.That(ex.ParamName, Is.EqualTo(nameof(request))); }
public async Task CallsDisableCustomerBankAccountEndpoint() { // given var subject = new CustomerBankAccountsClient(_clientConfiguration); var request = new DisableCustomerBankAccountRequest { Id = "BA12345678" }; // when await subject.DisableAsync(request); // then _httpTest .ShouldHaveCalled("https://api.gocardless.com/customer_bank_accounts/BA12345678/actions/disable") .WithVerb(HttpMethod.Post); }
public void DisableCustomerBankAccountRequestIdIsNullOrWhiteSpaceThrows(string id) { // given var subject = new CustomerBankAccountsClient(_clientConfiguration); var request = new DisableCustomerBankAccountRequest { Id = id }; // when AsyncTestDelegate test = () => subject.DisableAsync(request); // then var ex = Assert.ThrowsAsync <ArgumentException>(test); Assert.That(ex.ParamName, Is.EqualTo(nameof(request.Id))); }