Beispiel #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);
        }
Beispiel #2
0
        public void CanGetTax(string productType, bool expected)
        {
            ProductManager         productManager  = ProductManagerFactory.create();
            DisplayProductResponse productResponse = productManager.DisplayProductResponse(productType);

            Assert.AreEqual(productResponse.Success, expected);
        }
Beispiel #3
0
        public DisplayProductResponse DisplayProductResponse(string productType)
        {
            DisplayProductResponse productResponse = new DisplayProductResponse();

            productResponse.Products = _productRepository.DisplayProduct(productType);
            if (productResponse.Products is null)
            {
                productResponse.Success = false;
                productResponse.Message = $"{productType} is an invalid product type.";
            }
            else
            {
                productResponse.Success = true;
            }
            return(productResponse);
        }