コード例 #1
0
        public async Task can_update_a_checkout()
        {
            var requestInfo = @"""email""";

            SetupServerSingleResponse(CheckoutData.CheckoutWithRequestInfo(requestInfo));

            var updateCheckout = new UpdateCheckout
            {
                LocalPrice = new Money {
                    Amount = 200.00m, Currency = "USD"
                }
            };

            var update = await api.UpdateCheckoutAsync(CheckoutData.CheckoutModel.Id, updateCheckout);

            var truth = new Response <Checkout>
            {
                Data = CheckoutData.CheckoutModel
            };

            truth.Data.RequestedInfo.Add("email");

            truth.Should().BeEquivalentTo(update);

            server.ShouldHaveCalled($"https://api.commerce.coinbase.com/checkouts/{CheckoutData.CheckoutModel.Id}")
            .WithVerb(HttpMethod.Put);
        }
コード例 #2
0
        public async Task can_create_a_checkout()
        {
            var requestInfo = @"""email""";

            SetupServerSingleResponse(CheckoutData.CheckoutWithRequestInfo(requestInfo));

            var newCheckout = new CreateCheckout
            {
                Name        = "The Sovereign Individual",
                Description = "Mastering the Transition to the Information Age",
                LocalPrice  = new Money {
                    Amount = 100.00m, Currency = "USD"
                },
                PricingType  = PricingType.FixedPrice,
                RequestEmail = true
            };

            var checkout = await api.CreateCheckoutAsync(newCheckout);

            var truth = new Response <Checkout>
            {
                Data = CheckoutData.CheckoutModel
            };

            truth.Data.RequestedInfo.Add("email");

            truth.Should().BeEquivalentTo(checkout);

            server.ShouldHaveCalled("https://api.commerce.coinbase.com/checkouts")
            .WithVerb(HttpMethod.Post);
        }