public void RefactorPotatoCode()
        {
            Potato potato = new Potato();

            if (potato != null)
            {
                if (potato.HasBeenPeeled() && potato.IsRotten())
                {
                    this.Cook(potato);
                }
            }
        }
예제 #2
0
        public static void Main(string[] args)
        {
            // Task 2
            Chef   chef   = new Chef();
            Potato potato = new Potato();

            if (potato != null)
            {
                bool isPeeled = potato.HasBeenPeeled();
                bool isFresh  = potato.IsFresh();
                if (isPeeled && isFresh)
                {
                    chef.Cook(potato);
                }
            }
        }