Exemplo n.º 1
0
        public Bowl Cook(IList<Vegetable> vegetables)
        {
            Bowl cookingBowl = new Bowl();

            foreach (var veggie in vegetables)
            {
                cookingBowl.Add(veggie);
            }

            return cookingBowl;
        }
Exemplo n.º 2
0
        public Bowl Cook(IList <Vegetable> vegetables)
        {
            Bowl cookingBowl = new Bowl();

            foreach (var veggie in vegetables)
            {
                cookingBowl.Add(veggie);
            }

            return(cookingBowl);
        }
Exemplo n.º 3
0
        public void CookTest()
        {
            // Base code refactored functionally goes below
            Potato potato = new Potato();
            Carrot carrot = new Carrot();
            Bowl bowl = new Bowl();

            potato.Peel();
            carrot.Peel();
            potato.Cut();
            carrot.Cut();

            bowl.Add(carrot);
            bowl.Add(potato);

            // task2 - Potato COOKING! - included in the base code
            this.Cook(bowl.Ingredients);
        }
Exemplo n.º 4
0
        public void CookTest()
        {
            // Base code refactored functionally goes below
            Potato potato = new Potato();
            Carrot carrot = new Carrot();
            Bowl   bowl   = new Bowl();

            potato.Peel();
            carrot.Peel();
            potato.Cut();
            carrot.Cut();

            bowl.Add(carrot);
            bowl.Add(potato);

            // task2 - Potato COOKING! - included in the base code
            this.Cook(bowl.Ingredients);
        }
Exemplo n.º 5
0
        public Bowl Cook(Vegetable veggie)
        {
            Bowl cookingBowl = new Bowl();

            if (veggie != null)
            {
                cookingBowl.Add(veggie);

                if (cookingBowl.Ingredients.Count == 0)
                {
                    Console.WriteLine("Your attempt at cooking the vegetable was a big failure, vegetables must be peeled, cut and fresh!");
                    return cookingBowl;
                }
                else
                {
                    return cookingBowl;
                }
            }
            else
            {
                throw new ArgumentNullException();
            }
        }
Exemplo n.º 6
0
        public Bowl Cook(Vegetable veggie)
        {
            Bowl cookingBowl = new Bowl();

            if (veggie != null)
            {
                cookingBowl.Add(veggie);

                if (cookingBowl.Ingredients.Count == 0)
                {
                    Console.WriteLine("Your attempt at cooking the vegetable was a big failure, vegetables must be peeled, cut and fresh!");
                    return(cookingBowl);
                }
                else
                {
                    return(cookingBowl);
                }
            }
            else
            {
                throw new ArgumentNullException();
            }
        }