예제 #1
0
        public void CalculateTaxesForAnOrder_ThrowException_WhenOrderIsNull()
        {
            //Arrange
            var taxCalculator = new TaxJarCalculator();

            //Act
            var result = taxCalculator.CalculateTheTaxesForAnOrder(null);

            //Assert
            Assert.Equal("Order is invalid. (Parameter 'order')", result.Exception?.InnerException?.Message);
        }
예제 #2
0
        public void CalculateTaxesForAnOrder_ThrowException_WhenToCountryIsNull()
        {
            //Arrange
            var taxCalculator = new TaxJarCalculator();
            var order         = new Order {
                ToCountry = null
            };

            //Act
            var result = taxCalculator.CalculateTheTaxesForAnOrder(order);

            //Assert
            Assert.Equal("to_country is a required parameter. (Parameter 'ToCountry')", result.Exception?.InnerException?.Message);
        }
예제 #3
0
        public void CalculateTaxesForAnOrder_ThrowException_WhenCountryIsUSorCAToStateIsNull()
        {
            //Arrange
            var taxCalculator = new TaxJarCalculator();
            var order         = new Order
            {
                ToCountry = "US",
                Shipping  = 1.5f
            };

            //Act
            var result = taxCalculator.CalculateTheTaxesForAnOrder(order);

            //Assert
            Assert.Equal("to_state is a required parameter when country is US or CA. (Parameter 'ToState')", result.Exception?.InnerException?.Message);
        }