Example #1
0
        public void SetNightInvalidTest()
        {
            var menagerie = new Menagerie();

            menagerie.SetNight();
            Assert.ThrowsException <IsNightException>(() => menagerie.SetNight());
        }
Example #2
0
        public void NightHandleTest()
        {
            var handler = new NightNoiseHandler();

            var menagerie = new Menagerie();

            menagerie.SetNight();

            var result = handler.Handle(menagerie);

            Assert.AreEqual("Shhh... It's the night", result);
        }
Example #3
0
 private void btnSetNight_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         menagerie.SetNight();
         RefreshLb();
         DisplayMessage("The night has come");
     }
     catch (IsNightException)
     {
         DisplayMessage("It is already night");
     }
 }
Example #4
0
        public void SetNightTest()
        {
            var menagerie = new Menagerie();

            var animal1 = new Wolf("test", 1);
            var animal2 = new Bear("test2", 2);

            animal2.NightNight();

            menagerie.AddAnimal(animal1);
            menagerie.AddAnimal(animal2);

            menagerie.SetNight();

            Assert.IsTrue(animal1.IsSleeping);
            Assert.IsTrue(animal2.IsSleeping);
        }