예제 #1
0
        public void AddToMenu_ShouldGetCorrectBoolean()
        {
            //Arrange
            MenuItem       content = new MenuItem();
            CafeRepository repo    = new CafeRepository();

            //Act
            bool addResult = repo.AddMealToMenu(content);

            // Assert
            Assert.IsTrue(addResult);
        }
예제 #2
0
        public void GetContents_ShouldReturnCorrectCollection()
        {
            //Arrange
            MenuItem       content = new MenuItem();
            CafeRepository repo    = new CafeRepository();

            repo.AddMealToMenu(content);
            //Act
            List <MenuItem> contents            = repo.GetContents();
            bool            directoryHasContent = contents.Contains(content);

            //Assert
            Assert.IsTrue(directoryHasContent);
        }
예제 #3
0
        private void CreateNewItem()
        {
            Console.Clear();
            MenuItem content = new MenuItem();

            // title
            Console.WriteLine("Please enter the meal number: ");
            string itemNumber = Console.ReadLine();

            try
            {
                int result = Int32.Parse(itemNumber);
                Console.WriteLine(result);
                content.MealNumber = result;
            }
            catch (FormatException)
            {
                // Output: Unable to parse ''
                Console.WriteLine($"Unable to parse '{itemNumber}' Put in a number!");
                Console.ReadKey();
            }
            // MealName
            Console.WriteLine("Please enter the meal name: ");
            content.MealName = Console.ReadLine();
            // Description
            Console.WriteLine("Please enter the meal description: ");
            content.MealDescription = Console.ReadLine();
            // Ingredients - one string
            Console.WriteLine("Please enter the meal ingredients - separate by comma: ");
            content.Ingredients = Console.ReadLine();
            // Meal Price - double
            Console.WriteLine("Please enter the meal price  - two decimal places: ");
            string itemPrice = Console.ReadLine();

            content.MealPrice = Convert.ToDouble(itemPrice);
            // call repository add meal method
            _repo.AddMealToMenu(content);
        }
예제 #4
0
 public void Arrange()
 {
     _repo    = new CafeRepository();
     _content = new MenuItem(1, "Meatloaf", "Savory meatloaf and mashed potatoes", "Ground sirloin, eggs, ketchup, potatoes, milk, butter", 5.99);
     _repo.AddMealToMenu(_content);
 }