Exemplo n.º 1
0
        public void RetrieveProductInformationTest()
        {
            ProductManager manager = ProductManagerFactory.Create();

            ProductInformationResponse response = manager.ProductInformation("Tile");

            Assert.IsNotNull(response.Product);

            Product product = response.Product;

            Assert.AreEqual(product.ProductType, "Tile");
        }
Exemplo n.º 2
0
        public static void Field(Order order)

        {
            TaxLookUpResponse          taxResponse     = TaxManagerFactory.Create().TaxLookUp(order.State);
            ProductInformationResponse productResponse = ProductManagerFactory.Create().ProductInformation(order.ProductType);


            order.TaxRate            = Math.Round(taxResponse.TaxInformation.TaxRate, 2);
            order.CostPerSquareFoot  = Math.Round(productResponse.Product.CostPerSquareFoot, 2);
            order.LaborCostPerSquare = Math.Round(productResponse.Product.LaborCostPerSquareFoot, 2);


            order.MaterialCost = Math.Round(order.Area * order.CostPerSquareFoot, 2);
            order.LaborCost    = Math.Round(order.Area * order.LaborCostPerSquare, 2);

            order.Tax   = Math.Round(((order.MaterialCost + order.LaborCost) * (order.TaxRate / 100)), 2);
            order.Total = Math.Round((order.MaterialCost + order.LaborCost + order.Tax), 2);
        }
Exemplo n.º 3
0
        public ProductInformationResponse ProductInformation(string product)
        {
            ProductInformationResponse response = new ProductInformationResponse();

            response.Product = _productRepository.ProductInformation(product);

            if (response.Product == null)
            {
                response.Success = false;
                response.Message = $"Unable to product information for {product}";
            }
            else
            {
                response.Success = true;
            }

            return(response);
        }