Example #1
0
        public void PressButton()
        {
            Console.WriteLine("Pressing the remote control button...");

            if (_door.IsOpen())
            {
                _door.Close();
            }
            else
            {
                _door.Open();
            }
        }
        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.");
            }
        }