コード例 #1
0
        private void AddIngredientToMeal()
        {
            GetCafeContents();

            Console.WriteLine("\nEnter ID of meal you would like to add ingredient to:");
            string      identAsInt = Console.ReadLine();
            int         devID      = Convert.ToInt32(identAsInt);
            CafeContent pulledID   = _cafeRepo.GetMenuByID(devID);

            bool moreIngredients = true;

            while (moreIngredients == true)
            {
                GetIngredients();

                Console.WriteLine("What ingredient do you want to add to this meal:");
                string             ingred       = Console.ReadLine().Trim().ToLower();
                IngredientsContent pulledIngred = _iRepo.GetIngredientByName(ingred);

                pulledID.ListOfIngredients.Add(pulledIngred);

                Console.WriteLine("\nWould you like to add another ingredient?(yes/no)");
                string addAnother = Console.ReadLine().Trim().ToLower();
                if (addAnother == "yes")
                {
                    moreIngredients = true;
                }
                else
                {
                    moreIngredients = false;
                }
            }
        }
コード例 #2
0
        public void DefaultValues()
        {
            _repo    = new IngredientsRepo();
            _content = new IngredientsContent("Carrot");

            _repo.AddIngredient(_content);
        }
コード例 #3
0
        public void UpdateIngredient_ShouldReturnTrue(string originalName, bool shouldUpdate)
        {
            IngredientsContent newContent = new IngredientsContent("Salt");

            bool updateResult = _repo.UpdateIngredient(originalName, newContent);

            Assert.AreEqual(shouldUpdate, updateResult);
        }
コード例 #4
0
        public void AddIngredient_ShouldGetNotNull()
        {
            IngredientsContent soySauce = new IngredientsContent("Soy Sauce");

            _repo.AddIngredient(soySauce);

            Assert.IsNotNull(soySauce);
        }
コード例 #5
0
        public void DefaultValues()
        {
            _repo     = new CafeRepo();
            _iRepo    = new IngredientsRepo();
            _iContent = new IngredientsContent("bread");

            _listOfIngredients.Add(_iContent);
            _content = new CafeContent(1, "Grilled Cheese", "Melted cheese between two pieces of sourdough.", _listOfIngredients, 5.99);

            _repo.AddMenuItem(_content);
        }
コード例 #6
0
        private void GetIngredientByName()
        {
            Console.Clear();
            Console.WriteLine("Which ingredient are you looking for?");
            string             value   = Console.ReadLine();
            IngredientsContent content = _iRepo.GetIngredientByName(value);

            if (content != null)
            {
                Console.WriteLine($"Ingredient Name: {content.IngredientName}");
            }
            else
            {
                Console.WriteLine("Error...");
            }
        }
コード例 #7
0
        private void DefaultCafeListings()
        {
            IngredientsContent bread  = new IngredientsContent("bread");
            IngredientsContent cheese = new IngredientsContent("cheese");
            IngredientsContent butter = new IngredientsContent("butter");
            IngredientsContent ham    = new IngredientsContent("ham");
            IngredientsContent turkey = new IngredientsContent("turkey");

            _iRepo.AddIngredient(bread);
            _iRepo.AddIngredient(cheese);
            _iRepo.AddIngredient(butter);
            _iRepo.AddIngredient(ham);
            _iRepo.AddIngredient(turkey);

            List <IngredientsContent> grilledCheeseList = new List <IngredientsContent>();

            grilledCheeseList.Add(bread);
            grilledCheeseList.Add(cheese);
            grilledCheeseList.Add(butter);

            List <IngredientsContent> hamSammichList = new List <IngredientsContent>();

            hamSammichList.Add(bread);
            hamSammichList.Add(cheese);
            hamSammichList.Add(ham);

            List <IngredientsContent> turkeyHamList = new List <IngredientsContent>();

            turkeyHamList.Add(bread);
            turkeyHamList.Add(cheese);
            turkeyHamList.Add(ham);
            turkeyHamList.Add(turkey);

            CafeContent grilledCheese = new CafeContent(1, "Grilled Cheese Sammich", "Four pieces of cheeses of choice melted inbetween two slices of bread of choice", grilledCheeseList, 7.99);
            CafeContent hamSammich    = new CafeContent(2, "Ham and Cheese Sammich", " Ten slices of ham and three slices of melted cheese of choice inbetween two slices of bread of choice.", hamSammichList, 11.99);
            CafeContent turkeyHam     = new CafeContent(3, "Turkey Ham and Cheese Sammich", "Six slices of turkey, six slices of ham, and four slices of melted cheese of choice inbetween two slices of bread of choice.", turkeyHamList, 14.99);

            _cafeRepo.AddMenuItem(grilledCheese);
            _cafeRepo.AddMenuItem(hamSammich);
            _cafeRepo.AddMenuItem(turkeyHam);
        }