예제 #1
0
        public async Task GetTaxRateByZip_OkResponse()
        {
            //        {
            //            "rate": {
            //                "zip": "90404",
            //"state": "CA",
            //"state_rate": "0.0625",
            //"county": "LOS ANGELES",
            //"county_rate": "0.01",
            //"city": "SANTA MONICA",
            //"city_rate": "0.0",
            //"combined_district_rate": "0.025",
            //"combined_rate": "0.0975",
            //"freight_taxable": false
            //            }
            //        }

            var response = await _controller.GetTaxRateByZip("90404");

            Assert.NotNull(response);

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

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

            var taxRateLocation = (TaxRateLocation)ok.Value;

            Assert.Equal("90404", taxRateLocation.Zip);
            Assert.Equal("CA", taxRateLocation.State);
        }
        public async Task GetTaxRateByZip_OkResponse()
        {
            var response = await _controller.GetTaxRateByZip("33472");

            Assert.NotNull(response);

            if (response.Result is OkObjectResult ok)
            {
                Assert.Equal(ok.StatusCode, (int)HttpStatusCode.OK);

                var taxRateLocation = (TaxRateLocation)ok.Value;
                Assert.Equal("33472", taxRateLocation.Zip);
            }
        }