public void Arrange() { _repo = new CafeRepo(); _item = new Cafe(9, "Chicken Tenders", "Best Kid's Meal In House", new List <string> { "Chicken tenders", "your choice of potato", "your choice of dipping sauce" }, 5.00m); _repo.AddItemToCafe(_item); }
public void AddToCafe_ShouldGetNotNull() { //Arrange //Act _repo.AddItemToCafe(_item); Cafe itemFromDirectory = _repo.GetItemByNumber(9); //Assert Assert.IsTrue(_repo.GetCafeItemList().Contains(itemFromDirectory)); }
//create new Cafe item private void CreateNewCafeItem() { Console.Clear(); Cafe newItem = new Cafe(); //item number Console.WriteLine("Enter the item number for the Cafe item:"); string itemNumaSString = Console.ReadLine(); newItem.ItemNumber = int.Parse(itemNumaSString); //name Console.WriteLine("Enter the name of the new Cafe item:"); newItem.Name = Console.ReadLine(); //description Console.WriteLine("Enter the description of the new Cafe item:"); newItem.Description = Console.ReadLine(); //ingredients newItem.listOfIngredients = new List <string>(); bool keepAdding = true; while (keepAdding) { Console.WriteLine("Enter ingredients (one at a time):"); string ingredient = Console.ReadLine(); if (!newItem.listOfIngredients.Contains(ingredient)) { newItem.listOfIngredients.Add(ingredient); } else { Console.WriteLine("You've already added this ingredient to this Cafe item"); } bool validInput = true; while (validInput) { Console.WriteLine("Would you like to add another ingredient? (Y/N)"); string banana = Console.ReadLine().ToLower(); if (banana.Contains("n")) { keepAdding = false; validInput = false; } else if (banana.Contains("y")) { keepAdding = true; validInput = false; } else { Console.WriteLine("Error. Try typing Y or N"); validInput = true; } } } //price Console.WriteLine("Enter the price of the new Cafe item:"); decimal input = decimal.Parse(Console.ReadLine()); newItem.Price = input; _CafeRepo.AddItemToCafe(newItem); }