public async Task ReturnsIndividualCreditor()
        {
            // given
            var creditor = await _resourceFactory.Creditor();

            var subject = new CreditorsClient(_clientConfiguration);

            // when
            var result = await subject.ForIdAsync(creditor.Id);

            var actual = result.Item;

            // then
            Assert.That(actual, Is.Not.Null);
            Assert.That(actual.Id, Is.Not.Null.And.EqualTo(creditor.Id));
            Assert.That(actual.AddressLine1, Is.Not.Null.And.EqualTo(creditor.AddressLine1));
            Assert.That(actual.AddressLine2, Is.Not.Null.And.EqualTo(creditor.AddressLine2));
            Assert.That(actual.AddressLine3, Is.Not.Null.And.EqualTo(creditor.AddressLine3));
            Assert.That(actual.CanCreateRefunds, Is.Not.Null.And.EqualTo(creditor.CanCreateRefunds));
            Assert.That(actual.City, Is.Not.Null.And.EqualTo(creditor.City));
            Assert.That(actual.CountryCode, Is.Not.Null.And.EqualTo(creditor.CountryCode));
            Assert.That(actual.CreatedAt, Is.Not.Null.And.EqualTo(creditor.CreatedAt));
            Assert.That(actual.Links, Is.Not.Null);
            Assert.That(actual.Links.DefaultDkkPayoutAccount, Is.Not.Null);
            Assert.That(actual.Links.DefaultGbpPayoutAccount, Is.Not.Null);
            Assert.That(actual.Links.DefaultSekPayoutAccount, Is.Not.Null);
            Assert.That(actual.Name, Is.Not.Null.And.EqualTo(creditor.Name));
            Assert.That(actual.PostalCode, Is.Not.Null.And.EqualTo(creditor.PostalCode));
            Assert.That(actual.Region, Is.Not.Null.And.EqualTo(creditor.Region));
            Assert.That(actual.VerificationStatus, Is.Not.Null.And.EqualTo(creditor.VerificationStatus));

            Assert.That(actual.SchemeIdentifiers, Is.Not.Null);
            Assert.That(actual.SchemeIdentifiers.Any(), Is.True);

            var schemeIdentifier = actual.SchemeIdentifiers.SingleOrDefault(x => x.Currency == "GBP");

            Assert.That(schemeIdentifier, Is.Not.Null);
            Assert.That(schemeIdentifier.AddressLine1, Is.Not.Null);
            Assert.That(schemeIdentifier.CanSpecifyMandateReference, Is.True);
            Assert.That(schemeIdentifier.City, Is.Not.Null);
            Assert.That(schemeIdentifier.CountryCode, Is.Not.Null);
            Assert.That(schemeIdentifier.Currency, Is.Not.Null);
            Assert.That(schemeIdentifier.Email, Is.Not.Null);
            Assert.That(schemeIdentifier.MinimumAdvanceNotice, Is.Not.EqualTo(default(int)));
            Assert.That(schemeIdentifier.Name, Is.Not.Null);
            Assert.That(schemeIdentifier.PhoneNumber, Is.Not.Null);
            Assert.That(schemeIdentifier.PostalCode, Is.Not.Null);
            Assert.That(schemeIdentifier.Region, Is.Not.Null);
            Assert.That(schemeIdentifier.Reference, Is.Not.Null);
            Assert.That(schemeIdentifier.Scheme, Is.Not.Null);
        }
        public async Task CallsIndividualCreditorsEndpoint()
        {
            // given
            var subject = new CreditorsClient(_clientConfiguration);
            var id      = "CR12345678";

            // when
            await subject.ForIdAsync(id);

            // then
            _httpTest
            .ShouldHaveCalled("https://api.gocardless.com/creditors/CR12345678")
            .WithVerb(HttpMethod.Get);
        }
        public void IdIsNullOrWhiteSpaceThrows(string id)
        {
            // given
            var subject = new CreditorsClient(_clientConfiguration);

            // when
            AsyncTestDelegate test = () => subject.ForIdAsync(id);

            // then
            var ex = Assert.ThrowsAsync <ArgumentException>(test);

            Assert.That(ex.Message, Is.Not.Null);
            Assert.That(ex.ParamName, Is.EqualTo(nameof(id)));
        }