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 !"); } } }
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 !"); } } }
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); }
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)); }
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); }
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); }
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)); }