示例#1
0
 private static void Feed(Person person)
 {
     var shouldIEat = new IsHungrySpecification().And(new HasTeethSpecification());
     if (shouldIEat.IsSatisfiedBy(person))
     {
         person.Eat("Snacks");
     }
     else
     {
         Console.WriteLine("{0} is not hungry", person.Name);
     }
 }
示例#2
0
        private static void Feed(Person person)
        {
            var shouldIEat = new IsHungrySpecification().And(new HasTeethSpecification());

            if (shouldIEat.IsSatisfiedBy(person))
            {
                person.Eat("Snacks");
            }
            else
            {
                Console.WriteLine("{0} is not hungry", person.Name);
            }
        }