private void DeleteMenuItem() { Console.WriteLine("Enter the number of the menu item you would like to delete:"); int oldNumber = int.Parse(Console.ReadLine()); KomodoCafe CurrentNumber = _challengeOne.GetKomodoByCafe(oldNumber); Console.WriteLine($"{CurrentNumber.MealName} will be removed"); _challengeOne.RemoveContentFromList(CurrentNumber); }
public void RemoveFromListTest() { KomodoCafeRespository cafeRespository = new KomodoCafeRespository(); KomodoCafe komodo = new KomodoCafe(4, "Food", KomodoCafe.Ingredients.BurgerFriesDrink, "This meal is something", 3.0); _CafeRepo.AddCafeToList(komodo); bool wasRemoved = _CafeRepo.RemoveContentFromList(komodo); Assert.IsTrue(wasRemoved); }
public void GetKomodoByCafe() { KomodoCafeRespository komodoCafe = new KomodoCafeRespository(); KomodoCafe komodo = new KomodoCafe(4, "Food", KomodoCafe.Ingredients.BurgerFriesDrink, "This meal is something", 3.0); komodoCafe.AddCafeToList(komodo); KomodoCafe actual = _CafeRepo.GetKomodoByCafe(8); Assert.AreEqual(komodo, actual); }
private void SeedCafeList() { KomodoCafe BurgerMeal = new KomodoCafe(1, "Burger Meal", KomodoCafe.Ingredients.BurgerFriesDrink, "This meal contains a burger, fries and a drink.", 8.00); KomodoCafe HotDogMeal = new KomodoCafe(2, "HotDog Meal", KomodoCafe.Ingredients.HotDogFriesDrink, "This meal contains a hot dog, fries and a drink.", 6.00); KomodoCafe Nachos = new KomodoCafe(3, "Nachos", KomodoCafe.Ingredients.Nachos, "This meal is just nachos, lots of nachos.", 5.00); _challengeOne.AddCafeToList(BurgerMeal); _challengeOne.AddCafeToList(HotDogMeal); _challengeOne.AddCafeToList(Nachos); }
public void KomodoCafeUpdateTest() { _CafeRepo.AddCafeToList(_Cafe); KomodoCafe newCafe = new KomodoCafe(4, "Food", KomodoCafe.Ingredients.BurgerFriesDrink, "This meal is something", 3.0); _CafeRepo.UpdateExistingContent(6, newCafe); KomodoCafe UpdateCafe = _CafeRepo.GetKomodoByCafe(4); Assert.AreEqual(UpdateCafe.Cafe, newCafe.Cafe); }
//update public void UpdateExistingContent(int originalCafe, KomodoCafe newCafe) { //find the thing KomodoCafe oldCafe = GetKomodoByCafe(originalCafe); //apply changes to the thing oldCafe.MealNumber = newCafe.MealNumber; oldCafe.Cafe = newCafe.Cafe; oldCafe.OfIngredients = newCafe.OfIngredients; oldCafe.MealName = newCafe.MealName; oldCafe.Description = newCafe.Description; oldCafe.Price = newCafe.Price; }
//remove public bool RemoveContentFromList(KomodoCafe cafe) { int intialCount = _ListOfCafe.Count; _ListOfCafe.Remove(cafe); if (intialCount > _ListOfCafe.Count) { return(true); } else { return(false); } }
private void CreateMenuItem() { //intialize KomodoCafe cafe = new KomodoCafe(); //get meal number Console.Write("Enter the menu item starting at 4: "); cafe.MealNumber = int.Parse(Console.ReadLine()); Console.Write("Enter the name of the menu item you wish to add: "); cafe.MealName = Console.ReadLine(); Console.Write("Enter a description for your menu item: "); cafe.Description = Console.ReadLine(); Console.Write("Enter a price for your menu item: "); cafe.Price = double.Parse(Console.ReadLine()); //add to list _challengeOne.AddCafeToList(cafe); }
//add public void AddCafeToList(KomodoCafe cafe) { _ListOfCafe.Add(cafe); }
public void Arrange() { _CafeRepo = new KomodoCafeRespository(); _Cafe = new KomodoCafe(4, "Food", KomodoCafe.Ingredients.BurgerFriesDrink, "This meal is something", 3.0); }