Exemplo n.º 1
0
        static void Main(string[] args)
        {
            List <Dishes> listMeals = new List <Dishes>();

            string mealtime = string.Empty;
            string opc      = string.Empty;

            while (true)
            {
                try
                {
                    Console.WriteLine("Enter the time of day : morning or night (press CTRL+Z to exit):");
                    mealtime = Console.ReadLine();


                    if (Helper.ValidMealTime(mealtime))
                    {
                        Console.WriteLine("Enter with the meal type list numbers: (press CTRL+Z to exit):");
                        opc = Console.ReadLine();

                        var r = Helper.ValidOpc(opc);

                        if (!r.hasError)
                        {
                            var    listDishes = new DishesData().GetByDishType(opc, mealtime);
                            string dishes     = Helper.Format(listDishes);

                            Console.WriteLine(dishes);
                        }
                        else
                        {
                            Console.WriteLine(r.detail);
                        }
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("Unexpected error, try again !");
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            List<Dishes> listMeals = new List<Dishes>();

            string mealtime = string.Empty;
            string opc = string.Empty;

            while (true)
            {
                try
                {
                    Console.WriteLine("Enter the time of day : morning or night (press CTRL+Z to exit):");
                    mealtime = Console.ReadLine();

                    if (Helper.ValidMealTime(mealtime))
                    {
                        Console.WriteLine("Enter with the meal type list numbers: (press CTRL+Z to exit):");
                        opc = Console.ReadLine();

                        var r = Helper.ValidOpc(opc);

                        if (!r.hasError)
                        {
                            var listDishes = new DishesData().GetByDishType(opc, mealtime);
                            string dishes = Helper.Format(listDishes);

                            Console.WriteLine(dishes);
                        }
                        else
                        {
                            Console.WriteLine(r.detail);
                        }
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("Unexpected error, try again !");
                }

            }
        }
Exemplo n.º 3
0
        public void Test_Opc_Morning_1_2_3_3_3()
        {
            string opcs = "1,2,3,3,3";
            var dishes = new DishesData().GetByDishType(opcs, morning);
            var dishesFormated = Helper.Format(dishes);

            Assert.AreEqual("eggs,toasts,coffee(x3)", dishesFormated);
        }
Exemplo n.º 4
0
        public void Test_Opc_Night_1_2_3_4_NUnit()
        {
            string opcs = "1,2,3,4";
            var dishes = new DishesData().GetByDishType(opcs, night);
            var dishesFormated = Helper.Format(dishes);

            NUnit.Framework.Assert.AreEqual("steak,potato,wine,cake", dishesFormated);
            Console.WriteLine(string.Format("Test Night: input {0} output {1}", opcs, dishesFormated));
        }
Exemplo n.º 5
0
        public void Test_Opc_Night_1_2_3_4()
        {
            string opcs = "1,2,3,4";
            var dishes = new DishesData().GetByDishType(opcs, night);
            var dishesFormated = Helper.Format(dishes);

            Assert.AreEqual("steak,potato,wine,cake", dishesFormated);
        }
Exemplo n.º 6
0
        public void Test_Opc_Night_1_2_2_5_4()
        {
            string opcs = "1,2,2,5,4";
            var dishes = new DishesData().GetByDishType(opcs, night);
            var dishesFormated = Helper.Format(dishes);

            Assert.AreEqual("steak,potato(x2),error", dishesFormated);
        }
Exemplo n.º 7
0
        public void Test_Opc_Morning_2_1_3_NUnit()
        {
            string opcs = "2,1,3";
            var dishes = new DishesData().GetByDishType(opcs, morning);
            var dishesFormated = Helper.Format(dishes);

            NUnit.Framework.Assert.AreEqual("eggs,toasts,coffee", dishesFormated);
            Console.WriteLine(string.Format("Test Morning: input {0} output {1}", opcs, dishesFormated));
        }