public void Execute() { OrderManager manager = new OrderManager(); string date; Order selectedOrder; do { date = GetDate(); var orderNumber = GetOrderNumber(); selectedOrder = manager.GetOrder(date, orderNumber); if (selectedOrder == null) { Console.Clear(); Console.WriteLine("Order does not exist."); Console.Write("\nPress any key to continue, or (Q) to return to main menu..."); string input = Console.ReadLine(); if (input != null && input.ToUpper() == "Q") return; } } while (selectedOrder == null); PrintOrder(selectedOrder); Console.Write("\nPress enter to begin editing..."); Console.ReadLine(); selectedOrder = GetCustomerName(selectedOrder); selectedOrder = GetState(selectedOrder); selectedOrder = GetProductType(selectedOrder); selectedOrder = GetArea(selectedOrder); var response = manager.EditOrder(selectedOrder, date); if (response.Success) { Console.Clear(); Console.WriteLine(response.Message); Console.WriteLine(); PrintEditedOrder(response.Data); } else { Console.Clear(); Console.WriteLine("Something happened."); Console.WriteLine(response.Message); } Console.Write("\nPress any key to continue..."); Console.ReadKey(); }
public void EditOrderComputationTest() { string d = "06012013"; string expected = "Po"; var manager = new OrderManager(); MockOrdersRepo repo = new MockOrdersRepo(); Order orderToEdit= repo.GetAllOrders(d)[1]; orderToEdit.Name = expected; var editedOrder = manager.EditOrder(orderToEdit, d); Assert.AreEqual(expected, editedOrder.Data.Name); }