コード例 #1
0
        public void CanEditOrder(DateTime orderDate, int orderNumber, string newCustomerName, string newState, string newProductType, decimal newArea, bool expected)
        {
            OrderManager orderManager = OrderManagerFactory.create(orderDate);

            TaxManager         taxManager  = TaxManagerFactory.create();
            DisplayTaxResponse taxResponse = taxManager.DisplayTaxResponse(newState);

            ProductManager         productManager  = ProductManagerFactory.create();
            DisplayProductResponse productResponse = productManager.DisplayProductResponse(newProductType);

            Orders order = new Orders()
            {
                Area = newArea,
                CostPerSquareFoot      = productResponse.Products.CostPerSquareFoot,
                CustomerName           = newCustomerName,
                LaborCostPerSquareFoot = productResponse.Products.LaborCostPerSquareFoot,
                OrderNumber            = orderNumber,
                ProductType            = productResponse.Products.ProductType,
                State   = taxResponse.Tax.StateAbbreviation,
                TaxRate = taxResponse.Tax.TaxRate,
            };

            EditOrderResponse orderResponse = orderManager.EditOrder(order);

            Assert.AreEqual(orderResponse.Success, expected);
        }
コード例 #2
0
        public void CanGetTax(string stateAbreviation, string state, decimal taxRate, bool expected)
        {
            TaxManager         taxManager  = TaxManagerFactory.create();
            DisplayTaxResponse taxResponse = taxManager.DisplayTaxResponse(stateAbreviation);

            Assert.AreEqual(taxResponse.Success, expected);
        }
コード例 #3
0
        public DisplayTaxResponse DisplayTaxResponse(string state)
        {
            DisplayTaxResponse taxResponse = new DisplayTaxResponse();

            taxResponse.Tax = _taxRepository.DisplayTax(state);
            if (taxResponse.Tax is null)
            {
                taxResponse.Success = false;
                taxResponse.Message = $"{state} is an invalid state.";
            }
            else
            {
                taxResponse.Success = true;
            }
            return(taxResponse);
        }