// Create new MenuItem private void AddAMealNumber() { Console.Clear(); MenuItem newMenuItem = new MenuItem(); // Meal Number Console.WriteLine("Enter the meal number for the meal:"); string mealNumber = Console.ReadLine(); newMenuItem.MealNumber = int.Parse(mealNumber); // Meal Name Console.WriteLine("Enter a meal name for the meal:"); newMenuItem.MealName = Console.ReadLine(); // Description Console.WriteLine("Enter the description for the meal:"); newMenuItem.Description = Console.ReadLine(); // Ingredients Console.WriteLine("Please enter the first ingredient for your meal"); string ingredient = Console.ReadLine(); List <string> Ingredients = new List <string>(); Ingredients.Add(ingredient); bool keepRunning = true; while (keepRunning) { Console.WriteLine("Do you want to add another ingredient. Type y for yes or n for no."); string input = Console.ReadLine().ToLower(); switch (input) { case "y": // Add another ingredient Console.WriteLine("What is your next ingredient."); string ingredient2 = Console.ReadLine(); Ingredients.Add(ingredient2); break; case "n": keepRunning = false; break; } } newMenuItem.Ingredients = Ingredients; // Price Console.WriteLine("Please enter the price for the meal."); string mealPrice = Console.ReadLine(); newMenuItem.Price = decimal.Parse(mealPrice); _menuItemRepo.AddItemToMenu(newMenuItem); }
private void CreateNewMeal() { Console.Clear(); MenuItem newMeal = new MenuItem(); Console.WriteLine("Please assign this meal an unused meal number."); newMeal.MealNumber = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("What would you like this meal to be named?"); newMeal.MealName = Console.ReadLine(); Console.WriteLine("Enter a description for this meal"); newMeal.MealDescription = Console.ReadLine(); Console.WriteLine("List this meal's ingredients"); newMeal.MealIngredients = Console.ReadLine(); Console.WriteLine("Enter the price of this meal?"); newMeal.MealPrice = Convert.ToDecimal(Console.ReadLine()); bool wasAddedToMenu = _repo.AddItemToMenu(newMeal); if (wasAddedToMenu) { Console.WriteLine("The new menu item was successfully added"); } else { Console.WriteLine("The new menu item was not added."); } }
public void AddItemToMenu_ShouldReturnCorrectBool() { //Arrange MenuItem item = new MenuItem(); MenuItemRepository repository = new MenuItemRepository(); //Act bool addResult = repository.AddItemToMenu(item); //Assert Assert.IsTrue(addResult); }
public void GetMenu_ShouldGetCorrectBool() { MenuItem menuItem = new MenuItem(); MenuItemRepository repository = new MenuItemRepository(); repository.AddItemToMenu(menuItem); List <MenuItem> directory = repository.GetMenu(); bool directoryHasMenuItem = directory.Contains(menuItem); Assert.IsTrue(directoryHasMenuItem); }
public void Arrange() { _repo = new MenuItemRepository(); List <string> ingredients = new List <string>(); ingredients.Add("Pepperoni"); ingredients.Add("Sausage"); ingredients.Add("Tomato"); _menuItem = new MenuItem(1, "Pizza", "The best pizza in the whole world!", ingredients, 5.00m); _repo.AddItemToMenu(_menuItem); }
public void AddToList_ShouldGetNotNull() { // Arrange --> Setting up the playing field MenuItem foodItem = new MenuItem(); foodItem.MealNumber = 1; MenuItemRepository repository = new MenuItemRepository(); // Act --> Get/run the code we want to test repository.AddItemToMenu(foodItem); MenuItem foodItemFromDirectory = repository.GetMenuItemBytMealNumber(1); // Assert --> Use the assert class to verify the expected outcome Assert.IsNotNull(foodItemFromDirectory); }
public void Arrange() { _repo = new MenuItemRepository(); _menuItem = new MenuItem(1, "Beef Ramen", "A hot bowl of beef ramen, garnished with half a soft-boiled egg", "egg noodles, beef, cabbage, leek, carrots, soy broth, herbs and spices, one half softboiled egg, black sesame seeds", 8.99m); _repo.AddItemToMenu(_menuItem); }