예제 #1
0
        public void Recognize(Bark bark)
        {
            Console.WriteLine("    BarkRecognizer: Heard a \' {0} \'", bark.GetSound());

            var allowedBarks = _door.GetAllowedBarks();

            if (allowedBarks.Any(allowedBark => allowedBark.Equals(bark)))
            {
                _door.Open();
            }

            else
            {
                Console.WriteLine("This dog is not allowed.");
            }
        }
예제 #2
0
 public bool Equals(Bark otherBark)
 {
     return(_sound.Equals(otherBark.GetSound(), StringComparison.OrdinalIgnoreCase));
 }