Beispiel #1
0
        public async Task GetAllUsersTest()
        {
            // Arrange
            var query = new GetAllUsersQuery();

            // Action
            PagedResponse <IEnumerable <GetAllUsersViewModel> > result = await SendAsync(query);

            // Assertion
            result.Should().NotBeNull();
            result.Data.Should().BeEmpty();
            result.Succeeded.Should().Equals(false);
            result.Errors.Should().BeNull();
        }
        public async Task can_list_checkouts()
        {
            SetupServerPagedResponse(PageData.Pagination, CheckoutData.Checkout);

            var checkouts = await api.ListCheckoutsAsync();

            var truth = new PagedResponse <Checkout>
            {
                Pagination = PageData.PaginationModel,
                Data       = new[] { CheckoutData.CheckoutModel }
            };

            truth.Should().BeEquivalentTo(checkouts);

            server.ShouldHaveCalled("https://api.commerce.coinbase.com/checkouts")
            .WithVerb(HttpMethod.Get);
        }
        public async Task can_list_events()
        {
            SetupServerPagedResponse(PageData.Pagination, EventData.Event);

            var events = await api.ListEventsAsync();

            var truth = new PagedResponse <Event>()
            {
                Pagination = PageData.PaginationModel,
                Data       = new[] { EventData.EventModel }
            };

            truth.Should().BeEquivalentTo(events);

            server.ShouldHaveCalled("https://api.commerce.coinbase.com/events")
            .WithVerb(HttpMethod.Get);
        }
Beispiel #4
0
        public async Task can_list_accounts()
        {
            SetupServerPagedResponse(PaginationJson, $"{Account1},{Account2}");

            var accounts = await client.Accounts.ListAccountsAsync();

            var truth = new PagedResponse <Account>
            {
                Pagination = PaginationModel,
                Data       = new[] { Account1Model, Account2Model }
            };

            truth.Should().BeEquivalentTo(accounts);

            server.ShouldHaveExactCall("https://api.coinbase.com/v2/accounts")
            .WithVerb(HttpMethod.Get);
        }
Beispiel #5
0
        public async Task can_list_address_transactions()
        {
            SetupServerPagedResponse(PaginationJson, $"{Transaction1}");

            var txs = await client.Addresses.ListAddressTransactionsAsync("fff", "uuu");

            var truth = new PagedResponse <Transaction>
            {
                Pagination = PaginationModel,
                Data       = new [] { Transaction1Model }
            };

            truth.Should().BeEquivalentTo(txs);

            server.ShouldHaveExactCall($"https://api.coinbase.com/v2/accounts/fff/addresses/uuu/transactions")
            .WithVerb(HttpMethod.Get);
        }
Beispiel #6
0
        public async Task can_list_addresses()
        {
            SetupServerPagedResponse(PaginationJson, $"{Address1},{Address2}");

            var accounts = await client.Addresses.ListAddressesAsync("ffff");

            var truth = new PagedResponse <AddressEntity>
            {
                Pagination = PaginationModel,
                Data       = new[] { Address1Model, Address2Model }
            };

            truth.Should().BeEquivalentTo(accounts);

            server.ShouldHaveExactCall("https://api.coinbase.com/v2/accounts/ffff/addresses")
            .WithVerb(HttpMethod.Get);
        }
Beispiel #7
0
        public async Task can_list_charges()
        {
            SetupServerPagedResponse(Examples.Pagination, Examples.Charge);

            var charges = await com.ListChargesAsync();

            var truth = new PagedResponse <Charge>()
            {
                Pagination = Examples.PaginationModel,
                Data       = new[] { Examples.ChargeModel }
            };

            truth.Should().BeEquivalentTo(charges);

            server.ShouldHaveCalled("https://api.commerce.coinbase.com/charges")
            .WithVerb(HttpMethod.Get);
        }
Beispiel #8
0
        public async Task can_list()
        {
            SetupServerPagedResponse(PaginationJson, $"{Notification1}");

            var r = await client.Notifications.ListNotificationsAsync();

            var truth = new PagedResponse <Notification>
            {
                Pagination = PaginationModel,
                Data       = new[]
                {
                    Notification1Model
                }
            };

            truth.Should().BeEquivalentTo(r);

            server.ShouldHaveExactCall("https://api.coinbase.com/v2/notifications")
            .WithVerb(HttpMethod.Get);
        }
Beispiel #9
0
        public async Task can_list()
        {
            SetupServerPagedResponse(PaginationJson, $"{Sell1}");

            var r = await client.Sells.ListSellsAsync("fff");

            var truth = new PagedResponse <Sell>
            {
                Pagination = PaginationModel,
                Data       = new[]
                {
                    Sell1Model
                }
            };

            truth.Should().BeEquivalentTo(r);

            server.ShouldHaveExactCall("https://api.coinbase.com/v2/accounts/fff/sells")
            .WithVerb(HttpMethod.Get);
        }
Beispiel #10
0
        public async Task can_list()
        {
            SetupServerPagedResponse(PaginationJson, $"{PayMethod1},{PayMethod2}");

            var r = await client.PaymentMethods.ListPaymentMethodsAsync();

            var truth = new PagedResponse <PaymentMethod>
            {
                Pagination = PaginationModel,
                Data       = new[]
                {
                    PayMethod1Model,
                    PayMethod2Model
                }
            };

            truth.Should().BeEquivalentTo(r);

            server.ShouldHaveExactCall("https://api.coinbase.com/v2/payment-methods")
            .WithVerb(HttpMethod.Get);
        }
Beispiel #11
0
        public async Task can_list()
        {
            SetupServerPagedResponse(PaginationJson, $"{Transaction2},{Transaction3},{Transaction4},{Transaction5}");

            var r = await client.Transactions.ListTransactionsAsync("fff");

            var truth = new PagedResponse <Transaction>
            {
                Pagination = PaginationModel,
                Data       = new[]
                {
                    Transaction2Model,
                    Transaction3Model,
                    Transaction4Model,
                    Transaction5Model
                }
            };

            truth.Should().BeEquivalentTo(r);

            server.ShouldHaveExactCall("https://api.coinbase.com/v2/accounts/fff/transactions")
            .WithVerb(HttpMethod.Get);
        }