Exemplo n.º 1
0
        public AddBarksWindow(DogDoor dogDoor)
        {
            InitializeComponent();

            viewModel   = new AddBarksViewModel(dogDoor);
            DataContext = viewModel;
        }
Exemplo n.º 2
0
        public void DogDoorOpens()
        {
            DogDoor door = new DogDoor();

            door.Open();
            Assert.IsTrue(door.Status);
        }
Exemplo n.º 3
0
        public void TheDogDoorIsClosedOnCodeEntered()
        {
            DogDoor door = new DogDoor();
            //var doorClosed = door.Close();

            // Assert.IsTrue(doorClosed);
        }
Exemplo n.º 4
0
        public void DogDoorCloses()
        {
            DogDoor door = new DogDoor();

            door.Close();
            Assert.IsFalse(door.Status);
        }
Exemplo n.º 5
0
        public void TheRemoteClosesTheDoor()
        {
            DogDoor door = new DogDoor();

            door.Open();
            Remote rem = new Remote(door);

            Assert.IsFalse(rem.PressButton());
        }
Exemplo n.º 6
0
        public void RunSimulator()
        {
            // Dog Door Simulator

            DogDoor door   = new DogDoor();
            Remote  remote = new Remote(door);
            //Create the BarkRecognizer, connect it to the door, and let it listen for some barking.
            BarkRecognizer barkRecognizer = new BarkRecognizer(door);

            String sound = "bark";
            Bark   bark  = new Bark(sound);

            //Thread currentThread = Thread.CurrentThread;

            door.addAllowedBark(new Bark("rowlf"));
            door.addAllowedBark(new Bark("rooowlf"));
            door.addAllowedBark(new Bark("rawlf"));
            door.addAllowedBark(new Bark("woof"));


            // Simulate the hardware hearing a bark
            Console.WriteLine("Bruce starts barking.");
            barkRecognizer.Recognize(new Bark("rowlf"));

            Console.WriteLine("\nBruce has gone outside...");
            DogLockedOut(barkRecognizer);

            // Simulate the hardware hearing a bark (not Bruce!)
            Bark smallDogBark = new Bark("yip");

            Console.WriteLine("A small dog starts barking");
            barkRecognizer.Recognize(smallDogBark);

            try
            {
                Thread.Sleep(5000);
            }
            catch (ThreadInterruptedException) { }

            Console.WriteLine("Bruce starts barking.");
            barkRecognizer.Recognize(new Bark("rooowlf"));

            Console.WriteLine("\n Bruce's back inside");
        }
 public void TestSetup()
 {
     door       = new DogDoor();
     remote     = new Remote(door);
     recognizer = new BarkRecognizer(door);
 }
 public AddBarksViewModel(DogDoor dogDoor) => this.dogDoor = dogDoor;