public void DeathParameterTest() { Starvation starvation = new Starvation(); Province province = new Province(); Food food = new Food(); Should.Throw <ArgumentNullException>(() => { starvation.Death(null, food); }).Message.ShouldContain("province"); Should.Throw <ArgumentNullException>(() => { starvation.Death(province, null); }).Message.ShouldContain("food"); }
public void DeathTest() { Starvation starvation = new Starvation(); Province province = new Province(); Food food = new Food(); Population population = new Population().Add(1000); Population deathByStarvation = starvation.Death(province, food); deathByStarvation.Adults.ShouldBe(0); province = province.Add(population); deathByStarvation = starvation.Death(province, food); deathByStarvation.Adults.ShouldBeGreaterThan(0); }
public static IGameRule GameRuleToClass(Enum.GameRule gameRule) { IGameRule ruleType; switch (gameRule) { case Enum.GameRule.Age: ruleType = new Age(); break; case Enum.GameRule.Boredom: ruleType = new Boredom(); break; case Enum.GameRule.Hunger: ruleType = new Hunger(); break; case Enum.GameRule.Sleep: ruleType = new Sleep(); break; case Enum.GameRule.SleepDeprevation: ruleType = new SleepDeprivation(); break; case Enum.GameRule.Starvation: ruleType = new Starvation(); break; case Enum.GameRule.Munchies: ruleType = new Munchies(); break; case Enum.GameRule.Crazy: ruleType = new Crazy(); break; default: return(null); } return(ruleType); }
public void UsageTest() { Card x; x = new Attack(CardSuit.Club, 0); Assert.AreEqual(1, x.numOfTargets()); x = new Miss(CardSuit.Club, 0); Assert.AreEqual(-1, x.numOfTargets()); // this means not usable x = new Wine(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new Peach(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new Negate(CardSuit.Club, 0); Assert.AreEqual(-1, x.numOfTargets()); x = new Barbarians(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new HailofArrow(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new PeachGarden(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new Wealth(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new Steal(CardSuit.Club, 0); Assert.AreEqual(1, x.numOfTargets()); x = new Break(CardSuit.Club, 0); Assert.AreEqual(1, x.numOfTargets()); x = new Capture(CardSuit.Club, 0); Assert.AreEqual(1, x.numOfTargets()); x = new Starvation(CardSuit.Club, 0); Assert.AreEqual(1, x.numOfTargets()); x = new Crossbow(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new IceSword(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new Scimitar(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new BlackShield(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new EightTrigrams(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); }
public void TestStarvation() { _tamagotchi.Hunger = 81; _tamagotchi.Health = 50; var statvation = new Starvation(); statvation.Execute(_tamagotchi); Assert.IsTrue(_tamagotchi.Statuses.Contains(Status.Starved)); Assert.AreEqual(_tamagotchi.Health, 30); statvation.Execute(_tamagotchi); Assert.AreEqual(_tamagotchi.Statuses.Count(e => e == Status.Starved), 1); Assert.AreEqual(_tamagotchi.Health, 10); _tamagotchi.Hunger = 70; statvation.Execute(_tamagotchi); Assert.IsFalse(_tamagotchi.Statuses.Any(e => e == Status.Starved)); Assert.AreEqual(_tamagotchi.Health, 10); }
public void StarvationTest2() { Starvation c = new Starvation(CardSuit.Club, (byte)1); Assert.AreEqual("Starvation", c.ToString()); }
public void StarvationTest() { Starvation c = new Starvation(CardSuit.Club, (byte)1); Assert.AreEqual("Starvation Description", c.getDescription()); }