Ejemplo n.º 1
0
        public void Main()
        {
            // first task
            Potato potato = new Potato();

            if (IsValid(potato))
            {
                var IsReadyToCook = potato.ThereVegetablePeel && potato.IsCut;
                if (IsReadyToCook)
                {
                    var chef = new Chef();
                    chef.Cook(potato);
                }
            }

            // second task
            bool shouldVisitCell = true;
            int  horizontal      = 5;
            int  vertical        = 5;
            int  maxHorizontal   = 10;
            int  maxVertical     = 10;

            bool hasCorrectHorizontalValue = horizontal >= maxHorizontal && horizontal <= maxHorizontal;
            bool hasCorrectVerticalValue   = maxVertical >= vertical && maxVertical <= vertical;
            bool hasPremisionToVisitCell   = hasCorrectHorizontalValue && hasCorrectVerticalValue && shouldVisitCell;

            if (hasPremisionToVisitCell)
            {
                VisitCell();
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Potato potato = new Potato();

            //...
            if (potato != null)
            {
                if (!potato.HasNotBeenPeeled && !potato.IsRotten)
                {
                    Cook(potato);
                }
            }
        }
Ejemplo n.º 3
0
 private static void Cook(Potato potato)
 {
     throw new NotImplementedException();
 }