public static void DogDoorTestPath(int dogOutsideTime)
        {
            DogDoor door = new DogDoor();
            Remote remote = new Remote(door);

            Console.WriteLine("\nFido barks to go outside ...");
            remote.pressButton();

            Console.WriteLine("\nFido has gone outside for " + dogOutsideTime/1000 + " seconds ...");
            System.Threading.Thread.Sleep(dogOutsideTime);
            Console.WriteLine("\nFido's all done ...");

            bool firstBark = true;
            while (!door.isOpen)
            {
                if (firstBark)
                {
                    Console.WriteLine("\n... But he's stuck outside!");
                    Console.WriteLine("\nFido starts barking ...");
                    firstBark = false;
                    Console.WriteLine("\nSo Gina grabs the remote control ...");
                    remote.pressButton();
                }
            }

            Console.WriteLine("\nFido's back inside ...");

            while(door.isOpen)
            {
                // Wait
            }
            Console.WriteLine("\nTest passed! Press any key to continue.\n");
            
            Console.ReadKey();
        }
        public static void dogDoorTest()
        {
            DogDoor door   = new DogDoor();
            Remote  remote = new Remote(door);

            Console.WriteLine("Fido barks to go outside ...");
            remote.pressButton();
            Console.WriteLine("\nFido has gone outside ...");
            remote.pressButton();
            Console.WriteLine("\nFido's all done ...");
            remote.pressButton();
            Console.WriteLine("\nFido's back inside ...");
            remote.pressButton();
            Console.ReadKey();
        }
        public static void dogDoorTest()
        {
            DogDoor door = new DogDoor();
            Remote remote = new Remote(door);

            Console.WriteLine("Fido barks to go outside ...");
            remote.pressButton();
            Console.WriteLine("\nFido has gone outside ...");
            remote.pressButton();
            Console.WriteLine("\nFido's all done ...");
            remote.pressButton();
            Console.WriteLine("\nFido's back inside ...");
            remote.pressButton();
            Console.ReadKey();
        }
示例#4
0
 private static void InitiateDoorOpen(bool ownersResponsive, Remote remote, BarkRecognizer recognizer)
 {
     if (ownersResponsive)
     {
         Console.WriteLine("\nSo Gina grabs the remote control ...");
         remote.pressButton();
     }
     else
     {
         recognizer.recognize("Woof");
         Console.WriteLine("\nThe door hears the dog and opens ...");
     }
 }
 private static void InitiateDoorOpen(bool ownersResponsive, Remote remote, BarkRecognizer recognizer)
 {
     if (ownersResponsive)
     {
         Console.WriteLine("\nSo Gina grabs the remote control ...");
         remote.pressButton();
     }
     else
     {
         recognizer.recognize("Woof");
         Console.WriteLine("\nThe door hears the dog and opens ...");
     }
 }
示例#6
0
        public static void DogDoorTestPath(int dogOutsideTime)
        {
            DogDoor door   = new DogDoor();
            Remote  remote = new Remote(door);

            Console.WriteLine("\nFido barks to go outside ...");
            remote.pressButton();

            Console.WriteLine("\nFido has gone outside for " + dogOutsideTime / 1000 + " seconds ...");
            System.Threading.Thread.Sleep(dogOutsideTime);
            Console.WriteLine("\nFido's all done ...");

            bool firstBark = true;

            while (!door.isOpen)
            {
                if (firstBark)
                {
                    Console.WriteLine("\n... But he's stuck outside!");
                    Console.WriteLine("\nFido starts barking ...");
                    firstBark = false;
                    Console.WriteLine("\nSo Gina grabs the remote control ...");
                    remote.pressButton();
                }
            }

            Console.WriteLine("\nFido's back inside ...");

            while (door.isOpen)
            {
                // Wait
            }
            Console.WriteLine("\nTest passed! Press any key to continue.\n");

            Console.ReadKey();
        }
示例#7
0
 private static void InitiateDoorOpen(bool ownersResponsive, bool isOwnersDog, Remote remote, BarkRecognizer recognizer)
 {
     if (ownersResponsive)
     {
         Console.WriteLine("\nSo Gina grabs the remote control ...");
         remote.pressButton();
     }
     else
     {
         if (isOwnersDog)
         {
             // Now Bruce starts barking
             Console.WriteLine("\nBruce starts barking ...");
             recognizer.recognize(new Bark("rooowlf"));
         }
         else
         {
             // Begin with another dog barking
             Bark smallDogBark = new Bark("yip");
             Console.WriteLine("\nBitsie starts barking ...");
             recognizer.recognize(smallDogBark);
         }
     }
 }
 private static void InitiateDoorOpen(bool ownersResponsive, bool isOwnersDog, Remote remote, BarkRecognizer recognizer)
 {
     if (ownersResponsive)
     {
         Console.WriteLine("\nSo Gina grabs the remote control ...");
         remote.pressButton();
     }
     else
     {
         if (isOwnersDog)
         {
             // Now Bruce starts barking
             Console.WriteLine("\nBruce starts barking ...");
             recognizer.recognize(new Bark("rooowlf"));
         }
         else
         {
             // Begin with another dog barking
             Bark smallDogBark = new Bark("yip");
             Console.WriteLine("\nBitsie starts barking ...");
             recognizer.recognize(smallDogBark);
         }
     }
 }