コード例 #1
0
        public async Task GetTaxRateByOrder_OkResponse()
        {
            var response = await _controller.GetTaxRateByOrderId("1");

            Assert.NotNull(response);
            if (response.Result is OkObjectResult ok)
            {
                Assert.Equal(ok.StatusCode, (int)HttpStatusCode.OK);
            }
        }
コード例 #2
0
        public async Task GetTaxRateByOrder_OkResponse()
        {
            //            {
            //                "order": {
            //                    "transaction_id": "123",
            //        "user_id": 142698,
            //        "provider": "api",
            //        "transaction_date": "2015-05-14T00:00:00.000Z",
            //        "transaction_reference_id": null,
            //        "customer_id": null,
            //        "exemption_type": null,
            //        "from_country": "US",
            //        "from_zip": null,
            //        "from_state": null,
            //        "from_city": null,
            //        "from_street": null,
            //        "to_country": "US",
            //        "to_zip": "90002",
            //        "to_state": "CA",
            //        "to_city": "LOS ANGELES",
            //        "to_street": "123 Palm Grove Ln",
            //        "amount": "16.5",
            //        "shipping": "1.5",
            //        "sales_tax": "0.95",
            //        "line_items": [
            //            {
            //                "id": 0,
            //                "quantity": 1,
            //                "product_identifier": "12-34243-9",
            //                "product_tax_code": null,
            //                "description": "Fuzzy Widget",
            //                "unit_price": "15.0",
            //                "discount": "0.0",
            //                "sales_tax": "0.95"
            //            }
            //        ]
            //    }
            //}
            var response = await _controller.GetTaxRateByOrderId("123");

            Assert.NotNull(response);

            var ok = response.Result as Microsoft.AspNetCore.Mvc.OkObjectResult;

            Assert.Equal(ok.StatusCode, (int)HttpStatusCode.OK);

            var taxRateOrder = (TaxRateOrder)ok.Value;

            Assert.Equal(142698, taxRateOrder.User_Id);
            Assert.Equal("12-34243-9", taxRateOrder.Line_Items[0].Product_Identifier);
        }