コード例 #1
0
        public void CalculateOrderTest(int orderNumber, string customerName, string state, string productType, decimal Area, decimal taxRate, decimal costPerSquareFoot, decimal laborCostPerSquareFoot, decimal materialCost, decimal laborCost, decimal tax, bool expectedResult)
        {
            ICalculateOrder calculate;

            CalculateOrderRules calculateRule = new CalculateOrderRules();

            calculate = calculateRule;

            Order order = new Order();

            orderNumber            = order.OrderNumber;
            customerName           = order.CustomerName;
            state                  = order.State;
            productType            = order.ProductType;
            Area                   = order.Area;
            taxRate                = order.TaxRate;
            costPerSquareFoot      = order.CostPerSquareFoot;
            laborCostPerSquareFoot = order.LaborCostPerSquareFoot;
            materialCost           = order.MaterialCost;
            tax = order.Tax;

            CalculateOrderResponse response = calculate.CalculateOrder(customerName, productType, Area, state, taxRate, costPerSquareFoot, laborCostPerSquareFoot, materialCost, laborCost, tax);

            expectedResult = response.Success;

            Assert.AreEqual(expectedResult, response.Success);
            Assert.AreEqual(order.Tax, response.Tax);
            Assert.AreEqual(order.TaxRate, response.TaxRate);
            Assert.AreEqual(order.CostPerSquareFoot, response.CostPerSquareFoot);
            Assert.AreEqual(order.LaborCostPerSquareFoot, response.LaborCostPerSquareFoot);
            Assert.AreEqual(order.MaterialCost, response.MaterialCost);
        }
コード例 #2
0
        [TestCase("", "OH", 0, "Tile", 100.00, 0, 0, 0, 0, 0, 0, false)]          // invalid CustomerName
        public void CanAddOrderToOrderList(string customerName, string state, decimal taxRate, string productType, decimal area, decimal costPerSquareFoot, decimal laborCostPerSquareFoot, decimal materialCost, decimal laborCost, decimal tax, decimal total, bool expectedResult)
        {
            OrderManager manager = OrderManagerFactory.Create();

            DateTime          date        = new DateTime(2021, 01, 01);
            AllOrdersResponse allResponse = manager.RetrieveAllOrders(new DateTime(2021, 01, 01));
            List <Order>      orderList   = allResponse.Orders;

            Order newOrder = new Order();

            newOrder.OrderDate              = new DateTime(2021, 01, 01);
            newOrder.OrderNumber            = orderList.Max(order => order.OrderNumber) + 1;
            newOrder.CustomerName           = customerName;
            newOrder.State                  = state;
            newOrder.TaxRate                = 0;
            newOrder.ProductType            = productType;
            newOrder.Area                   = area;
            newOrder.CostPerSquareFoot      = costPerSquareFoot;
            newOrder.LaborCostPerSquareFoot = laborCostPerSquareFoot;
            newOrder.MaterialCost           = materialCost;
            newOrder.LaborCost              = laborCost;
            newOrder.Tax   = tax;
            newOrder.Total = total;

            AddOrderResponse       response  = new AddOrderResponse();
            CalculateOrderResponse response2 = manager.CalculateOrder(newOrder);

            if (response2.Success)
            {
                response = manager.AddOrder(response2.Order);
            }

            Assert.AreEqual(expectedResult, response.Success);
        }
コード例 #3
0
        public CalculateOrderResponse CalculateOrder(Order newOrder)
        {
            CalculateOrderResponse response    = new CalculateOrderResponse();
            List <Product>         productList = _productRepository.LoadAllProducts();
            List <Tax>             taxList     = _taxRepository.LoadAllTax();

            if (string.IsNullOrEmpty(newOrder.CustomerName))
            {
                response.Success = false;
                response.Message = $"Customer Name can not be blank.";
            }
            else if (newOrder.Area < 100)
            {
                response.Success = false;
                response.Message = $"{newOrder.Area} is not greater than the minimum 100 area.";
            }
            else if (productList.Where(product => product.ProductType == newOrder.ProductType).ToList().Count == 0)
            {
                response.Success = false;
                response.Message = $"{newOrder.ProductType} is not a valid product type.";
            }
            else if (taxList.Where(tax => tax.StateAbbreviation == newOrder.State.ToUpper()).ToList().Count == 0)
            {
                response.Success = false;
                response.Message = $"{newOrder.State} is not serviced by this company.";
            }
            else
            {
                Tax taxCalculations = taxList.Where(tax => tax.StateAbbreviation == newOrder.State.ToUpper()).ToList()[0]; // SET CORRECT TAXRATE VALUE FOR CALCULATION

                newOrder.TaxRate = taxCalculations.TaxRate;

                Product productCalculations = productList.Where(product => product.ProductType == newOrder.ProductType).ToList()[0]; // SET CORRECT PRODUCT COST / PRODUCT LABOR COST VALUES FOR CALCULATION

                newOrder.CostPerSquareFoot      = productCalculations.CostPerSquareFoot;
                newOrder.LaborCostPerSquareFoot = productCalculations.LaborCostPerSquareFoot;

                // CALCULATE
                newOrder.MaterialCost = (newOrder.Area * newOrder.CostPerSquareFoot);
                newOrder.LaborCost    = (newOrder.Area * newOrder.LaborCostPerSquareFoot);
                newOrder.Tax          = ((newOrder.MaterialCost + newOrder.LaborCost) * (newOrder.TaxRate / 100));
                newOrder.Total        = (newOrder.MaterialCost + newOrder.LaborCost + newOrder.Tax);

                response.Order   = newOrder;
                response.Success = true;
            }
            return(response);
        }
コード例 #4
0
ファイル: OrderManager.cs プロジェクト: npeskoe/portfolio
        public CalculateOrderResponse CalculateOrder(Order order, string customerName, string state, string productType, decimal Area)
        {
            CalculateOrderResponse response = new CalculateOrderResponse();

            response.Order = _orderRepository.CalculateOrder(order, customerName, state, productType, Area);

            if (response.Order == null)
            {
                response.Success = false;
                response.Message = "Error: Unable to add order. See IT.";
                return(response);
            }
            else
            {
                response.Success = true;
            }
            return(response);
        }
コード例 #5
0
        public CalculateOrderResponse CalculateOrder(string customerName, string productType, decimal Area, string State, decimal taxRate, decimal costPerSquareFoot,
                                                     decimal LaborCostPerSquareFoot, decimal materialCost, decimal laborCost, decimal tax)
        {
            CalculateOrderResponse response = new CalculateOrderResponse();

            response.CustomerName           = customerName;
            response.ProductType            = productType;
            response.Area                   = Area;
            response.State                  = State;
            response.TaxRate                = taxRate;
            response.CostPerSquareFoot      = costPerSquareFoot;
            response.LaborCostPerSquareFoot = LaborCostPerSquareFoot;

            response.Success = true;

            response.Message = "Additional Order Details Calculated";

            return(response);
        }
コード例 #6
0
        public void Execute()
        {
            bool notValidOrder = true;

            while (notValidOrder)
            {
                OrderManager orderManager = OrderManagerFactory.Create();

                Order order = new Order();

                Console.Clear();

                bool notValidDate = true;

                while (notValidDate)
                {
                    DateTime orderDate;
                    Console.WriteLine("Please Enter the Order Date: (MMDDYYYY): ");
                    string userDate = Console.ReadLine();
                    string format   = "MMddyyyy";

                    if (DateTime.TryParseExact(userDate, format, CultureInfo.InvariantCulture, DateTimeStyles.None, out orderDate))
                    {
                        order.OrderDate = orderDate;
                        notValidDate    = false;
                    }
                    else
                    {
                        Console.WriteLine();
                        Console.WriteLine("That is Not a Valid Date. Please Re-Enter Correct Order Date.");
                        notValidDate = true;
                    }
                }

                Console.WriteLine();

                Console.WriteLine("Please Enter the Customer Name: ");
                order.CustomerName = Console.ReadLine();

                Console.WriteLine();

                bool notValidStateEntry = true;

                while (notValidStateEntry)
                {
                    Console.WriteLine("Please Enter Two-Digit State Code: ");
                    order.State = Console.ReadLine().ToUpper();

                    if (string.IsNullOrEmpty(order.State))
                    {
                        Console.WriteLine("State Name Cannot Be Empty. Please Enter State Again.");
                        notValidStateEntry = true;
                    }
                    else if (order.State.All(char.IsDigit))
                    {
                        Console.WriteLine("State Name Cannot Contain Numbers. Please Enter State Again.");
                        notValidStateEntry = true;
                    }
                    else if (order.State.Count() > 2)
                    {
                        Console.WriteLine("State Name Must Be Only 2 Digits. Please Enter State Again.");
                        notValidStateEntry = true;
                    }
                    else
                    {
                        notValidStateEntry = false;
                        break;
                    }
                }

                string filePath = @"C:\Data\FlooringMastery\Products.txt";

                List <Products> products = new List <Products>();

                using (StreamReader sr = new StreamReader(filePath))
                {
                    sr.ReadLine();

                    List <string> lines = new List <string>();

                    while (!sr.EndOfStream)
                    {
                        lines.Add(sr.ReadLine());
                    }
                    foreach (var p in lines)
                    {
                        Products product = new Products();

                        string[] columns = p.Split(',');

                        product.ProductType = columns[0];

                        product.CostPerSquareFoot = decimal.Parse(columns[1]);

                        product.LaborCostPerSquareFoot = decimal.Parse(columns[2]);

                        products.Add(product);
                    }
                    Console.WriteLine();
                    Console.WriteLine("Please Select New Product: ");
                    Console.WriteLine();

                    foreach (var p in products)
                    {
                        Console.WriteLine(p.ProductType);
                    }
                    Console.WriteLine();
                    string ptype = Console.ReadLine();

                    order.ProductType = ptype.Substring(0, 1).ToUpper() + ptype.Substring(1);

                    bool notValidArea = true;

                    Console.WriteLine();

                    while (notValidArea)
                    {
                        Console.WriteLine("Please Enter Flooring Area: ");

                        string userInput = Console.ReadLine();

                        if (decimal.TryParse(userInput, out decimal area))
                        {
                            order.Area   = area;
                            notValidArea = false;
                            break;
                        }
                        else
                        {
                            Console.WriteLine("Flooring Area Must be a Number.");
                            notValidArea = true;
                        }
                    }

                    EditOrderResponse editOrder = orderManager.EditOrder(order, order.OrderDate, order.CustomerName, order.State, order.ProductType, order.Area);

                    if (editOrder.Success)
                    {
                        CalculateOrderResponse calculateOrder = orderManager.CalculateOrder(order, order.CustomerName, order.State, order.ProductType, order.Area);

                        if (calculateOrder.Success)
                        {
                            ConsoleIO.ChangeOrderDetails(order);
                            Console.WriteLine();

                            bool notYesOrNo = true;

                            while (notYesOrNo)
                            {
                                Console.WriteLine("Are you sure you want to change this order (Y/N)?");
                                string input = Console.ReadLine().ToUpper();

                                if (input == "Y")
                                {
                                    WriteOrderResponse writeOrder = orderManager.WriteOrder(order, order.OrderDate, order.OrderNumber, order.CustomerName, order.State,
                                                                                            order.TaxRate, order.ProductType, order.Area, order.CostPerSquareFoot, order.LaborCostPerSquareFoot, order.MaterialCost, order.LaborCost, order.Tax, order.Total);

                                    if (writeOrder.Success)
                                    {
                                        Console.Clear();
                                        Console.WriteLine("Order Updated!");
                                        notValidOrder = false;
                                        Console.WriteLine("Press any key to continue...");
                                        Console.ReadKey();
                                        break;
                                    }
                                    else
                                    {
                                        Console.Clear();
                                        Console.WriteLine("An error occured: ");
                                        Console.WriteLine(writeOrder.Message);
                                        Console.WriteLine("Press any key to continue...");
                                        Console.ReadKey();
                                        notValidOrder = true;
                                    }
                                }
                                if (input == "N")
                                {
                                    Environment.Exit(1);
                                }
                                else
                                {
                                    Console.WriteLine("Please Enter Y or N.");
                                    notYesOrNo = true;
                                }
                            }
                        }
                        else
                        {
                            Console.Clear();
                            Console.WriteLine("An error occured: ");
                            Console.WriteLine(editOrder.Message);
                            Console.WriteLine("Press any key to continue...");
                            Console.ReadKey();
                            notValidOrder = true;
                        }
                    }
                    else
                    {
                        Console.Clear();
                        Console.WriteLine("An error occured: ");
                        Console.WriteLine(editOrder.Message);
                        Console.WriteLine("Press any key to continue...");
                        Console.ReadKey();
                        notValidOrder = true;
                    }
                }
            }
        }
コード例 #7
0
        public void Execute(OrderManager manager)
        {
            Console.Clear();
            List <Tax>     taxList     = manager.RetrieveAllTax();
            List <Product> productList = manager.RetrieveAllProducts();

            Console.Clear();
            Console.WriteLine("Edit an Order");
            Console.WriteLine(ConsoleIO.SeparatorBar);
            Console.WriteLine("");

            int      orderNumber = ConsoleIO.GetRequiredIntFromUser("Enter an order number: ");
            DateTime orderDate   = ConsoleIO.GetRequiredLookUpDateTimeFromUser("Enter order date: ");

            OrderLookupResponse lookupResponse = manager.LookupOrder(orderDate, orderNumber); // CONFIRM ORDER EXISTS


            if (lookupResponse.Success)                // PROCEED TO EDIT
            {
                int changesMade = 0;

                ConsoleIO.DisplayOrderDetails(lookupResponse.Order); // DISPLAY UNEDITED VERSION OF THE ORDER
                Console.WriteLine("\n Enter new order details, or press enter to leave unchanged.");

                Console.Write($"Enter Customer Name ({lookupResponse.Order.CustomerName}):"); // USER INPUT CUSTOMERNAME OR ENTER
                string editCustomerName = Console.ReadLine();
                if (!string.IsNullOrEmpty(editCustomerName))                                  // IF THEY DID NOT LEAVE IT BLANK,
                {
                    lookupResponse.Order.CustomerName = editCustomerName;                     // UPDATE IT TO WHATEVER THEY PUT IN.
                }

                ConsoleIO.DisplayStateList(taxList);                      // DISPLAY LIST OF STATES
                Console.Write($"State: ({lookupResponse.Order.State}):"); // USER INPUT STATE OR ENTER
                while (true)
                {
                    string editState = Console.ReadLine();

                    if (string.IsNullOrEmpty(editState))
                    {
                        editState = lookupResponse.Order.State;
                        break;
                    }
                    else if (taxList.Where(tax => tax.StateAbbreviation == editState.ToUpper()).ToList().Count == 0)
                    {
                        Console.WriteLine($"{editState} is not a state serviced by this company. Please provide a valid state.");
                        editState = Console.ReadLine();
                    }
                    else
                    {
                        lookupResponse.Order.State = editState;
                        changesMade++;
                        break;
                    }
                }
                ConsoleIO.DisplayProductList(productList);                             // DISPLAY LIST OF PRODUCTS
                Console.Write($"Product Type: ({lookupResponse.Order.ProductType}):"); // USER INPUT PRODUCT OR ENTER

                while (true)
                {
                    string editProductType = Console.ReadLine();

                    if (string.IsNullOrEmpty(editProductType))
                    {
                        editProductType = lookupResponse.Order.ProductType;
                        break;
                    }
                    else if (productList.Where(product => product.ProductType == editProductType).ToList().Count == 0)
                    {
                        Console.WriteLine($"{editProductType} is not a product provided by this company. Please provide a valid product type.");
                        editProductType = Console.ReadLine();
                    }
                    else
                    {
                        lookupResponse.Order.ProductType = editProductType;
                        changesMade++;
                        break;
                    }
                }

                Console.Write($"Area: ({lookupResponse.Order.Area}):"); // USER INPUT AREA AS STRING
                string  editAreaInput = Console.ReadLine();
                decimal editArea;                                       // AREA NEEDS TO BE A DECIMAL SO DECLARED HERE FOR LATER

                while (true)
                {
                    if (string.IsNullOrEmpty(editAreaInput))  // IF THE AREA STRING IS BLANK
                    {
                        editArea = lookupResponse.Order.Area; // REMAINS THE SAME
                        break;
                    }
                    else if (!decimal.TryParse(editAreaInput, out editArea)) // CHECK TO MAKE SURE THE STRING THEY ENTERED CAN BE PARSED TO DECIMAL
                    {                                                        // IF IT CAN'T, TELL THEM TO LEAVE IT UNCHANGED OR GIVE A VALID DECIMAL
                        Console.WriteLine("You must enter a valid decimal, or hit enter to remain unchanged.");
                        editAreaInput = Console.ReadLine();
                    }
                    else if (editArea < 100) // IF THEY'VE PROVIDED A VALID DECIMAL TO CHANGE IT TO, CHECK IT'S OVER 100.
                    {
                        Console.WriteLine("You must enter an area greater than or equal to 100.");
                        editAreaInput = Console.ReadLine();
                    }
                    else
                    {
                        lookupResponse.Order.Area = editArea;
                        changesMade++;
                        break;
                    }
                }

                if (changesMade == 0)
                {
                    // CONFIRM USER WANTS TO UPDATE ORDER NAME
                    Console.Clear();
                    Console.WriteLine("Order Summary");
                    Console.WriteLine(ConsoleIO.SeparatorBar);
                    ConsoleIO.DisplayOrderDetails(lookupResponse.Order); // DISPLAY ORDER AFTER NAME UPDATED

                    if (ConsoleIO.GetYesNoAnswerFromUser("Save updated order?") == "Y")
                    {
                        AddOrderResponse addResponse = new AddOrderResponse(); // BC THEY WANT TO SAVE, CREATE AN AddResponse
                        addResponse = manager.AddOrder(lookupResponse.Order);  // addResponse will be the response I get back by trying to save response.Order

                        if (addResponse.Success)
                        {
                            Console.Clear();
                            Console.WriteLine("Order Updated Successfully!");
                            ConsoleIO.DisplayOrderDetails(addResponse.Order);
                        }
                        else
                        {
                            Console.WriteLine("An error occurred: ");
                            Console.WriteLine(addResponse.Message);
                        }
                    }
                    else // THEY DON'T WANT TO SAVE, DISCARD IT RETURN TO MAIN MENU
                    {
                        Console.WriteLine("Changes Cancelled!");
                    }
                }
                else if (changesMade != 0)
                {
                    // PASS UPDATED ORDER INFO TO CALCULATOR ONLY IF THE USER MADE CHANGES TO STATE/PRODUCT/AREA
                    CalculateOrderResponse calculateResponse = new CalculateOrderResponse();
                    calculateResponse = manager.CalculateOrder(lookupResponse.Order); // OVERWRITE response.Order W/CALCULATIONS

                    if (calculateResponse.Success)
                    {
                        Console.Clear();
                        Console.WriteLine("Order Summary");
                        Console.WriteLine(ConsoleIO.SeparatorBar);
                        ConsoleIO.DisplayOrderDetails(calculateResponse.Order); // DISPLAY ORDER AFTER CALCULATING

                        if (ConsoleIO.GetYesNoAnswerFromUser("Save updated order?") == "Y")
                        {
                            AddOrderResponse addResponse = new AddOrderResponse();   // BC THEY WANT TO SAVE, CREATE AN AddResponse
                            addResponse = manager.AddOrder(calculateResponse.Order); // addResponse will be the response I get back by trying to save response.Order

                            if (addResponse.Success)
                            {
                                Console.Clear();
                                Console.WriteLine("Order Updated Successfully!");
                                ConsoleIO.DisplayOrderDetails(addResponse.Order);
                            }
                            else
                            {
                                Console.WriteLine("An error occurred: ");
                                Console.WriteLine(addResponse.Message);
                            }
                        }
                        else // THEY DON'T WANT TO SAVE, DISCARD IT RETURN TO MAIN MENU
                        {
                            Console.WriteLine("Changes Cancelled!");
                        }
                    }
                    else
                    {
                        Console.WriteLine("An error occurred: "); // INVALID NAME/STATE/PRODUCT/AREA
                        Console.WriteLine(calculateResponse.Message);
                    }
                }
                else
                {
                    Console.WriteLine("An error occurred: "); // ORDER DOES NOT EXIST
                    Console.WriteLine(lookupResponse.Message);
                }

                Console.WriteLine("Press any key to continue.");
                Console.ReadKey();
            }
        }
コード例 #8
0
        public void Execute(OrderManager manager)
        {
            Console.Clear();

            Console.Clear();
            Console.WriteLine("Add an Order");
            Console.WriteLine(ConsoleIO.SeparatorBar);
            Console.WriteLine("");

            Order newOrder = new Order();                                                     // QUERY FOR ALL PARTS OF AN ORDER OBJECT FROM USER

            newOrder.OrderDate = ConsoleIO.GetRequiredFutureDateTimeFromUser("Order Date: "); // ORDER DATE

            newOrder.OrderNumber = 0;                                                         // Order number is 0 by default and gets set at save time

            newOrder.CustomerName = ConsoleIO.GetRequiredStringFromUser("Customer Name: ");   // CUSTOMER NAME

            List <Tax> taxList = manager.RetrieveAllTax();

            ConsoleIO.DisplayStateList(taxList);                                                       // DISPLAY LIST OF STATES
            newOrder.State = ConsoleIO.GetRequiredStateFromUser("State (by abbreviation): ", taxList); // SELECT/VALIDATE STATE

            newOrder.TaxRate = 0;

            List <Product> productList = manager.RetrieveAllProducts();

            ConsoleIO.DisplayProductList(productList);                                                  // DISPLAY LIST OF PRODUCTS

            newOrder.ProductType = ConsoleIO.GetRequiredProductFromUser("Product Type: ", productList); // SELECT/VALIDATE PRODUCT TYPE

            newOrder.Area = ConsoleIO.GetRequiredAreaFromUser("Area: ");                                // AREA

            // CALCULATION PLACEHOLDERS FOR AFTER USER QUERY
            newOrder.CostPerSquareFoot      = 0;
            newOrder.LaborCostPerSquareFoot = 0;
            newOrder.MaterialCost           = 0;
            newOrder.LaborCost = 0;
            newOrder.Tax       = 0;
            newOrder.Total     = 0;

            AddOrderResponse       addResponse       = new AddOrderResponse();
            CalculateOrderResponse calculateResponse = manager.CalculateOrder(newOrder); // SEND TO BLL FOR CALCULATING

            if (calculateResponse.Success)
            {
                Console.Clear();
                Console.WriteLine("Order Summary");
                Console.WriteLine(ConsoleIO.SeparatorBar);
                ConsoleIO.DisplayOrderDetails(calculateResponse.Order);           // DISPLAY ORDER AFTER CALCULATING

                if (ConsoleIO.GetYesNoAnswerFromUser("Place the order? ") == "Y") // If user says save it...
                {
                    addResponse = manager.AddOrder(calculateResponse.Order);

                    if (addResponse.Success) // Logic layer sends back a response...if it's success, great.
                    {
                        Console.Clear();
                        Console.WriteLine("Order Saved Successfully!");
                        ConsoleIO.DisplayOrderDetails(addResponse.Order);
                    }
                    else // otherwise, it will return a message in regards to which of the 4 failed (CustomerName/State/Product/Area).
                    {
                        Console.WriteLine("An error occurred: ");
                        Console.WriteLine(addResponse.Message);
                    }
                }
                else // if user says no don't save it...even better, just tell them it's cancelled and go on back to Main Menu.
                {
                    Console.WriteLine("Order Cancelled!");
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                }
            }
            else
            {
                Console.WriteLine("An error occurred: ");
                Console.WriteLine(calculateResponse.Message);
            }

            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
        }
コード例 #9
0
        [TestCase("Winter", "OH", "", "50", 2, false)]         // Area < 100
        public void CanEditOrder(string editCustomerName, string editStateAbbreviation, string editProductType, string editAreaInput, int changesMade, bool expectedResult)
        {
            OrderManager manager = OrderManagerFactory.Create();

            AllOrdersResponse allResponse = manager.RetrieveAllOrders(new DateTime(2021, 01, 01));
            List <Order>      orderList   = allResponse.Orders;
            List <Tax>        taxList     = manager.RetrieveAllTax();
            List <Product>    productList = manager.RetrieveAllProducts();
            decimal           editArea;

            OrderLookupResponse lookupResponse = manager.LookupOrder(new DateTime(2021, 01, 01), 1);

            if (lookupResponse.Success)
            {
                if (!string.IsNullOrEmpty(editCustomerName))              // IF THEY DID NOT LEAVE IT BLANK,
                {
                    lookupResponse.Order.CustomerName = editCustomerName; // UPDATE IT TO WHATEVER THEY PUT IN.
                }

                if (!string.IsNullOrEmpty(editStateAbbreviation))
                {
                    lookupResponse.Order.State = editStateAbbreviation.ToUpper();
                }

                if (!string.IsNullOrEmpty(editProductType))
                {
                    lookupResponse.Order.ProductType = editProductType;
                }

                if (!string.IsNullOrEmpty(editAreaInput))               // IF THE AREA STRING IS NOT BLANK
                {
                    if (!decimal.TryParse(editAreaInput, out editArea)) // CHECK TO MAKE SURE THE STRING CAN BE PARSED TO DECIMAL
                    {                                                   // IF IT CAN'T, TELL THEM TO LEAVE IT UNCHANGED OR GIVE A VALID DECIMAL
                        lookupResponse.Success = false;
                    }
                    else
                    {
                        if (editArea < 100) // IF THEY'VE PROVIDED A VALID DECIMAL TO CHANGE IT TO, CHECK IT'S OVER 100.
                        {
                            lookupResponse.Success = false;
                        }
                        lookupResponse.Order.Area = editArea; // UPDATE THE AREA TO WHATEVER THEY PUT IN.
                    }

                    if (changesMade == 0)
                    {
                        AddOrderResponse addResponse1 = new AddOrderResponse();
                        addResponse1 = manager.AddOrder(lookupResponse.Order);

                        Assert.AreEqual(expectedResult, addResponse1.Success);
                    }
                    else if (changesMade != 0)
                    {
                        AddOrderResponse       addResponse2      = new AddOrderResponse();
                        CalculateOrderResponse calculateResponse = manager.CalculateOrder(lookupResponse.Order);

                        if (calculateResponse.Success)
                        {
                            addResponse2 = manager.AddOrder(calculateResponse.Order);
                        }

                        Assert.AreEqual(expectedResult, addResponse2.Success);
                    }
                }
            }
        }