public void Tamagotchi_Dead_DoNothing() { var rules = new Rule[] { new AthleticRule(), new BordedomRule(), new CrazinessRule(), new FatigueRule(), new HungerRule(), new IsolationRule(), new MuchiesRule(), new SleepDeprivationRule(), new StarvationRule() }; rules = rules.OrderBy(r => r.Order).ToArray(); Tamagotchi t1 = new Tamagotchi("test", rules); t1.HasDied = true; var now = DateTime.UtcNow + TimeSpan.FromHours(2); Assert.IsFalse(t1.EatAction(now)); Assert.IsFalse(t1.RefreshRules(now)); Assert.AreNotEqual(t1.LastAllRulesPassedUtc, now); }
public void TamagotchiAction_EatValue() { Tamagotchi t = new Tamagotchi(0, 0, 10, 0, new DateTime(1994, 1, 5, 10, 10, 10), TimeSpan.Zero); t.EatAction(new DateTime(1994, 1, 5, 10, 10, 10)); Assert.AreEqual(0, t.Hunger); }
public void TamagotchiAction_EatDoNothingInCooldown() { var dateTime = new DateTime(1994, 1, 5, 10, 10, 10); Tamagotchi t = new Tamagotchi(10, 10, 10, 10, dateTime, new TimeSpan(1)); Assert.IsFalse(t.EatAction(dateTime)); Assert.AreEqual(10, t.Hunger); }
public void TamagotchiAction_EatDoNothingInCooldown() { var dateTime = new DateTime(1994, 1, 5, 10, 10, 10); Tamagotchi t = new Tamagotchi(10,10,10,10, dateTime, new TimeSpan(1)); Assert.IsFalse(t.EatAction(dateTime)); Assert.AreEqual(10, t.Hunger); }
public void TamagotchiAction_EatValue() { var dateTime = new DateTime(1994, 1, 5, 10, 10, 10); Tamagotchi t = new Tamagotchi(0, 0, 10, 0, DateTime.MinValue, TimeSpan.Zero); Assert.IsTrue(t.EatAction(dateTime)); Assert.AreEqual(dateTime, t.LastAccessedOnUtc); Assert.AreEqual(new TimeSpan(0, 0, 30), t.CoolDown); Assert.IsTrue(t.IsInCoolDown(dateTime + new TimeSpan(0, 0, 10))); }
public void TamagotchiAction_EatValue() { var dateTime = new DateTime(1994, 1, 5, 10, 10, 10); Tamagotchi t = new Tamagotchi(0, 0, 10, 0, DateTime.MinValue, TimeSpan.Zero); Assert.IsTrue(t.EatAction(dateTime)); Assert.AreEqual(dateTime, t.LastAccessedOnUtc); Assert.AreEqual(new TimeSpan(0,0,30), t.CoolDown); Assert.IsTrue(t.IsInCoolDown(dateTime + new TimeSpan(0, 0, 10))); }