public void Rules_StarvationRule_Value() { var dateTime = new DateTime(1994, 1, 5, 10, 10, 10); Tamagotchi t = new Tamagotchi(0, 0, 95, 0, dateTime, TimeSpan.Zero); Rule rule = new StarvationRule(); Rule hun = new HungerRule(); rule.Execute(t, dateTime); Assert.IsFalse(t.HasDied); hun.Execute(t, dateTime + TimeSpan.FromHours(2)); rule.Execute(t, dateTime + TimeSpan.FromHours(2)); Assert.IsTrue(t.HasDied); }
public void Rules_HungerRule_Value() { CheckRule(new HungerRule(), tama => tama.Hunger, new TimeSpan(1, 0, 0), 5); CheckRule(new HungerRule(), tama => tama.Hunger, new TimeSpan(2, 0, 0), 10); CheckRule(new HungerRule(), tama => tama.Hunger, new TimeSpan(25, 0, 0), 100); var dateTime = new DateTime(1994, 1, 5, 10, 10, 10); Tamagotchi t = new Tamagotchi(81, 0, 0, 0, dateTime, TimeSpan.Zero); t.HasMunchies = true; Rule fr = new HungerRule(); fr.Execute(t, dateTime + new TimeSpan(2, 0, 0)); Assert.AreEqual(20, t.Hunger); }
public void Rules_StarvationRule_DoNothingIsAthletic() { var dateTime = new DateTime(1994, 1, 5, 10, 10, 10); Tamagotchi t = new Tamagotchi(0, 0, 95, 0, dateTime, TimeSpan.Zero); Rule rule = new SleepDeprivationRule(); Rule hun = new HungerRule(); Rule ath = new AthleticRule(); ath.Execute(t, dateTime); rule.Execute(t, dateTime); Assert.IsFalse(t.HasDied); hun.Execute(t, dateTime + TimeSpan.FromHours(2)); rule.Execute(t, dateTime + TimeSpan.FromHours(2)); Assert.IsFalse(t.HasDied); }