public void AddNewMenuItem_ShouldReturnTrue() { MenuItem item = new MenuItem(); CafeRepo repo = new CafeRepo(); bool wasAdded = repo.AddNewMenuItem(item); Assert.IsTrue(wasAdded); }
public void GetMenuItemByName_ShouldReturnCorrectItem() { CafeRepo repo = new CafeRepo(); MenuItem pizza = new MenuItem(1, "Pizza", "pizza", new List <string>(), 1.00m); repo.AddNewMenuItem(pizza); MenuItem searchResult = repo.GetMenuItemByName("Pizza"); Assert.AreEqual(pizza, searchResult); }
public void GetAllMenuItems_ShouldReturnNotNull() { var repo = new CafeRepo(); var item = new MenuItem(); repo.AddNewMenuItem(item); List <MenuItem> getMenu = repo.GetAllMenuItems(); Assert.IsNotNull(getMenu); }
public void RemoveMenuItem_ShouldReturnTrue() { var item = new MenuItem(); var repo = new CafeRepo(); repo.AddNewMenuItem(item); bool wasRemoved = repo.RemoveMenuItem(item); Assert.IsTrue(wasRemoved); }
public void Arrange() { _repo = new CafeRepo(); List <string> ingredientsForBNM = new List <string> { "Bananas, Walnuts, flour, sugar, salt" }; _item = new Menu(1, "Banana Nut Muffin", "A delicious banana muffin packed with walnuts", ingredientsForBNM, 2.99); _repo.AddNewMenuItem(_item); }
public void AddToMenu_ShouldGetNotNull() { List <string> ingredientsForOCM = new List <string> { "orange rind", "dried cranberries", "flour", "sugar", "salt" }; Menu item2 = new Menu(2, "Orange Cranberry Muffin", "A delicious muffin packed with orange and cranberry flavours", ingredientsForOCM, 2.99); _repo.AddNewMenuItem(item2); Menu itemFromMenu = _repo.GetMenuItemByNumber(2); Assert.IsNotNull(itemFromMenu); }
public void CreateNewMenuItem() { List <string> ingredients = new List <string>(); Console.Write("Enter is the meal number: "); int mealNumber = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter the menu item name: "); string mealName = Console.ReadLine(); Console.Write("Enter the description: "); string description = Console.ReadLine(); Console.Write("Enter an ingredient: "); ingredients.Add(Console.ReadLine()); Console.Write("Add another ingredient (y/n)?: "); string userInput = Console.ReadLine(); while (userInput == "y") { Console.Write("Enter an ingredient: "); ingredients.Add(Console.ReadLine()); Console.Write("Add another ingredient (y/n)?: "); userInput = Console.ReadLine(); } Console.Write("Enter the price: "); // breaks if you don't enter decimal value decimal price = Convert.ToDecimal(Console.ReadLine()); MenuItem newItem = new MenuItem(mealNumber, mealName, description, ingredients, price); menu.AddNewMenuItem(newItem); Console.WriteLine("Press any key to return to main menu."); Console.ReadKey(); Console.Clear(); MainMenu(); }
private void CreateMenuItem() { Console.Clear(); Menu newItem = new Menu(); Console.WriteLine("Please input the number you would like to use for this item:"); newItem.MealNumber = int.Parse(Console.ReadLine()); Console.WriteLine("Input the name you would like to use for this item:"); newItem.MealName = Console.ReadLine(); Console.WriteLine("Please give this item a description:"); newItem.Description = Console.ReadLine(); Console.WriteLine("Please input the ingredients this item contains:\n" + "Seperate each item with a ',' "); var line = Console.ReadLine(); string[] ingredientsArr = line.Split(','); List <string> ingredientsList = new List <string>(ingredientsArr); newItem.Ingredients = ingredientsList; Console.WriteLine("Input a price for this item:\n" + "(Does not need a $, Example: 2.99"); newItem.Price = double.Parse(Console.ReadLine()); _menuRepo.AddNewMenuItem(newItem); }