public void SetNightInvalidTest() { var menagerie = new Menagerie(); menagerie.SetNight(); Assert.ThrowsException <IsNightException>(() => menagerie.SetNight()); }
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); }
private void btnSetNight_Click(object sender, RoutedEventArgs e) { try { menagerie.SetNight(); RefreshLb(); DisplayMessage("The night has come"); } catch (IsNightException) { DisplayMessage("It is already night"); } }
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); }