private void AddToContent() //add to menu { Console.Clear(); // a new content object MenuContent content = new MenuContent(); //user input //menu number Console.WriteLine("Please enter the number of the menu item."); string contentNumber = Console.ReadLine(); content.Number = contentNumber; Console.WriteLine($"Please enter the name of the menu item for {content.Number}"); //name string contentName = Console.ReadLine(); content.Name = contentName; //description Console.WriteLine($"Please enter the description for {content.Number}"); string contentDescription = Console.ReadLine(); content.Description = contentDescription; //ingredients Console.WriteLine($"Please enter the ingredients for {content.Number}"); string contentIngredients = Console.ReadLine(); content.Ingredients = contentIngredients; //price Console.WriteLine($"Please enter the price for {content.Number}"); double contentPrice = Convert.ToDouble(Console.ReadLine()); content.Price = contentPrice; //add item if (_menuRepo.AddContentToRepo(content)) { Console.WriteLine($"Item added."); } else { Console.WriteLine("Added item failed."); } //a new content with properties filled out by user //Pass that to the add method in our repo Console.WriteLine("Press any key to continue...."); Console.ReadKey(); }
public void AddToRepo_ShouldGetCorrectBool() { //arrange MenuContent content = new MenuContent(); MenuRepo repository = new MenuRepo(); //act bool addResult = repository.AddContentToRepo(content); //assert Assert.IsTrue(addResult); }
public void GetRepository_ShouldReturnCorrectRepo() { //arrange MenuContent _newObject = new MenuContent(); MenuRepo repo = new MenuRepo(); MenuContent _dishObject = new MenuContent("#1", "Sesame Chicken", "Chicken in sesame sauce with vegetables.", "chicken, sesame sauce, broccoli, carrots, water chestnuts", 8.95); repo.AddContentToRepo(_dishObject); MenuContent _dishObject2 = new MenuContent("#2", "Beef Lo Mein", "Beef and noodles with vegetables.", "beef, lo mein sauce, broccoli, carrots, water chestnuts", 9.95); repo.AddContentToRepo(_dishObject2); repo.AddContentToRepo(_newObject); //act List <MenuContent> listOfDishes = repo.GetContents(); //assert bool repoHasContent = listOfDishes.Contains(_newObject); Assert.IsTrue(repoHasContent); }
public void DeleteExistingContent_ShouldReturnTrue() { //arrange MenuRepo repo = new MenuRepo(); MenuContent _dishObject = new MenuContent("#1", "Sesame Chicken", "Chicken in sesame sauce with vegetables.", "chicken, sesame sauce, broccoli, carrots, water chestnuts", 8.95); repo.AddContentToRepo(_dishObject); //act bool deleteResult = repo.DeleteExistingContent(_dishObject); //assert Assert.IsTrue(deleteResult); }