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."); } }
public bool Equals(Bark otherBark) { return(_sound.Equals(otherBark.GetSound(), StringComparison.OrdinalIgnoreCase)); }