예제 #1
0
        public void AddItemsToCart_UpdateTotal()
        {
            test.AddItemToCart(chips);
            test.AddItemToCart(gum);
            test.AddItemToCart(drink);
            test.CalculateTotalShoppingCart(test.ShoppingCart);

            Assert.AreEqual(7.60M, test.TotalCart);
        }
예제 #2
0
        private static void MainMenu()
        {
            CircusOf();
            string[] menu = { "(1) Insert Money", "(2) Select Product", "(3) Finish Transaction", "(4) Close Vending Machine", $"Current Money Provided: ${machine.CurrentMoneyProvided} " };
            PrintMenus(menu);

            Value();
            string purchaseMenuResult = Console.ReadLine();

            if (purchaseMenuResult == "1" || purchaseMenuResult.ToUpper() == "INSERT" || purchaseMenuResult.ToUpper() == "I")
            {
                Console.Clear();
                FeedMoneyMenu();
            }
            else if (purchaseMenuResult == "2" || purchaseMenuResult.ToUpper() == "SELECT" || purchaseMenuResult.ToUpper() == "S")
            {
                Console.Clear();
                ShoppingCartMenu();
            }
            else if (purchaseMenuResult == "3" || purchaseMenuResult.ToUpper() == "FINISH" || purchaseMenuResult.ToUpper() == "F")
            {
                Console.Clear();
                machine.CalculateTotalShoppingCart(machine.ShoppingCart);
                CompleteTransactionMenu();
            }
            else if (purchaseMenuResult == "4" || purchaseMenuResult.ToUpper() == "CLOSE" || purchaseMenuResult.ToUpper() == "C")
            {
                Console.Clear();
                Environment.Exit(0);
            }
            else
            {
                Console.Clear();
                string[] invalid = { $"You Entered {purchaseMenuResult}. This Is Not A Valid Option." };
                PrintMenus(invalid);
                MainMenu();
            }
        }