public void MonsterGenTest() { //Arrange MonsterCreator M = new MonsterCreator(r, 10); for (int i = 0; i < 100; i++) { //Act Enemy e = M.CreateMonster(r.Next(int.MinValue, int.MaxValue)); //Assert Assert.IsNotNull(e); Assert.IsTrue(e.MaxHP >= 1); Assert.IsTrue(e.MaxHP >= e.CurrentHP); } }
public void EnemyMovementTest()//test if monsters do not enter the spaces of other monsters in their pack { Node n = new Node(random, 0, 100); //arrange MonsterCreator M = new MonsterCreator(random, 20); Pack pack = new Pack(10); while (pack.Enemies.Count < pack.Enemies.Capacity) { Enemy x = M.CreateMonster(1); pack.Add(x); } Player p = new Player(); Enemy y = pack[0]; p.Location = new System.Drawing.Point(5, 5); pack[1].Location = new System.Drawing.Point(5, 4); pack[2].Location = new System.Drawing.Point(4, 5); pack[3].Location = new System.Drawing.Point(6, 5); pack[4].Location = new System.Drawing.Point(5, 6); pack[5].Location = new System.Drawing.Point(4, 4); pack[6].Location = new System.Drawing.Point(3, 3); n.AddPack(pack); n.Player = p; y.Location = new System.Drawing.Point(2, 2); //act for (int i = 0; i < 100; i++) { n.Move(y, p.Location); //assert foreach (Enemy en in pack) { if (en != y) { Assert.AreNotEqual(y.Location, en.Location); } } } }
public void EnemySetterTest() { //Arrange MonsterCreator M = new MonsterCreator(random, 20); Enemy e = M.CreateMonster(1); //act e.CurrentHP = 1; for (int i = 0; i < 100; i++) { e.CurrentHP++; } Assert.IsTrue(e.MaxHP >= e.CurrentHP); e.MaxHP = 100; char c = e.Glyph; e.Alive = false; }