public void Execute()
        {
            OrderManager manager = new OrderManager();

            Order orderToRemove;
            string date;

            do
            {
                date = GetDate();
                var orderNumber = GetOrderNumber();
                orderToRemove = manager.GetOrder(date, orderNumber);

                if (orderToRemove == 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 (orderToRemove == null);

            PrintOrderToRemove(orderToRemove);

            if (!GetConfirmation())
                return;

            var response = manager.RemoveOrder(date, orderToRemove);

            if (response.Success)
            {
                Console.Clear();
                Console.WriteLine(response.Message);
            }
            else
            {
                Console.Clear();
                Console.WriteLine("A problem occurred...");
                Console.WriteLine(response.Message);
            }

            Console.Write("Press any key to continue...");
            Console.ReadKey();
        }
Пример #2
0
        public void RemoveOrderTest()
        {
            string d = "06012013";

            var manager = new OrderManager();
            MockOrdersRepo repo = new MockOrdersRepo();
            List<Order> OldOrders = repo.GetAllOrders(d);
            Order orderToRemove = repo.GetAllOrders(d)[0];

            manager.RemoveOrder(d, orderToRemove);
            List<Order> expected = repo.GetAllOrders(d);

            Assert.False(OldOrders.Contains(orderToRemove));
        }