public void NTest_getPackHPValue_validHP() { Dungeon dungeon = new Dungeon(3, 4); Pack pack = new Pack("1", 3, dungeon); int packHP = 0; foreach (Monster m in pack.members) { packHP += m.HP; } Assert.AreEqual(packHP, pack.getPackHPValue()); }
public void NTest_getAction() { Dungeon dungeon = new Dungeon(3, 4); Pack pack = new Pack("1", 10, dungeon); int H = pack.getPackHPValue(); int orgH = pack.startingHP; double possibility = ((1 - (H / orgH)) / 2); int flee = 0; for (int i = 0; i < 100; i++) { if (pack.getAction() == 2) { flee++; } } bool inBetween = (possibility <= (flee + 20) / 100) && (possibility >= (flee - 20) / 100); Assert.IsTrue(inBetween); }