private void btnSetDay_Click(object sender, RoutedEventArgs e) { try { menagerie.SetDay(); RefreshLb(); DisplayMessage("The day has come"); } catch (IsDayException) { DisplayMessage("It is already day"); } }
public void SetDayTest() { var menagerie = new Menagerie(); menagerie.SetNight(); var animal1 = new Wolf("test", 1); var animal2 = new Bear("test2", 2); animal2.NightNight(); menagerie.AddAnimal(animal1); menagerie.AddAnimal(animal2); menagerie.SetDay(); Assert.IsFalse(animal1.IsSleeping); Assert.IsFalse(animal2.IsSleeping); }
public void SetDayInvalidTest() { var menagerie = new Menagerie(); Assert.ThrowsException <IsDayException>(() => menagerie.SetDay()); }