Ejemplo n.º 1
0
        public void TestZipParameterVerificationForFailure()
        {
            var zipResponse = _taxServicecontroller.GetTaxRateForLocation(null, null, null, null, null);

            Assert.AreEqual(_taxServicecontroller.Response.StatusCode, 400);

            Assert.AreEqual(null, zipResponse);
        }
Ejemplo n.º 2
0
        public void GetTaxRateForLocation()
        {
            // Arrange
            TaxServiceController controller = new TaxServiceController();

            // Act

            // Verify tax rate is successfully returned with valid query
            Decimal result = controller.GetTaxRateForLocation(new TaxRequest()
            {
                FromCountry    = "US",
                FromState      = "NY",
                FromCity       = "New York",
                FromZip        = "10003",
                Amount         = 100,
                ShippingAmount = 0,
                ToCountry      = "US",
                ToState        = "CT",
                ToZip          = "06877",
                NexusAddresses = new List <NexusAddress>()
                {
                    new NexusAddress
                    {
                        Country = "US",
                        State   = "NY",
                        ZipCode = "10003"
                    },
                    new NexusAddress
                    {
                        Country = "US",
                        State   = "CT",
                        ZipCode = "06877"
                    }
                }
            });

            // Assert

            // Valid query
            Assert.IsNotNull(result);
            // Value returned is a decimal greater than or equal to 0
            Assert.IsTrue(result.GetType() == typeof(decimal) && result >= 0);
        }