コード例 #1
0
        public void IdIsNullOrWhiteSpaceThrows(string id)
        {
            // given
            var subject = new RefundsClient(_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)));
        }
コード例 #2
0
        public async Task CallsIndividualRefundsEndpoint()
        {
            // given
            var subject = new RefundsClient(_clientConfiguration);
            var id      = "RF12345678";

            // when
            await subject.ForIdAsync(id);

            // then
            _httpTest
            .ShouldHaveCalled("https://api.gocardless.com/refunds/RF12345678")
            .WithVerb(HttpMethod.Get);
        }
コード例 #3
0
        public async Task ReturnsIndividualRefund()
        {
            // given
            var subject = new RefundsClient(_clientConfiguration);
            var refund  = (await subject.GetPageAsync()).Items.First();

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

            var actual = result.Item;

            // then
            Assert.That(actual, Is.Not.Null);
            Assert.That(actual.Id, Is.Not.Null.And.EqualTo(refund.Id));
            Assert.That(actual.Amount, Is.Not.Null.And.EqualTo(refund.Amount));
            Assert.That(actual.Currency, Is.Not.Null.And.EqualTo(refund.Currency));
            Assert.That(actual.CreatedAt, Is.Not.Null.And.EqualTo(refund.CreatedAt));
            Assert.That(actual.Links, Is.Not.Null);
            Assert.That(actual.Links.Mandate, Is.Not.Null.And.EqualTo(refund.Links.Mandate));
            Assert.That(actual.Links.Payment, Is.Not.Null.And.EqualTo(refund.Links.Payment));
            Assert.That(actual.Metadata, Is.Not.Null.And.EqualTo(refund.Metadata));
            Assert.That(actual.Reference, Is.Not.Null.And.EqualTo(refund.Reference));
        }