public void TestAddDuplicateUnits() { UnitRoster roster = new UnitRoster(null, UnitTeam.team1); UnitEntity mu = new UnitEntity(); Assert.IsTrue(roster.AddUnit(mu), "Original add unit not successful"); Assert.IsFalse(roster.AddUnit(mu), "Duplicate add unit was not prevented"); }
public void TestGetAllUnits() { UnitRoster roster = new UnitRoster(null, UnitTeam.team1); UnitEntity mu; mu = new UnitEntity(); roster.AddUnit(mu); mu = new UnitEntity(); roster.AddUnit(mu); Assert.AreEqual(2, roster.GetAllUnits().Count, "Multiple add units not supported"); }
public void TestFindUnitByName() { UnitRoster roster = new UnitRoster(null, UnitTeam.team1); UnitEntity mu = new UnitEntity(); string name = "Sebastian"; mu.InternalName = name; roster.AddUnit(mu); Assert.AreEqual(mu, roster.GetUnitByName(name), "Roster GetUnitByName was not successful"); }
public void TestAddUnits() { UnitRoster constructorRoster = new UnitRoster(new UnitEntity[1] { new UnitEntity() }, UnitTeam.team1); Assert.AreEqual(1, constructorRoster.GetAllUnits().Count, "Roster constructor add unit was not successful"); UnitRoster roster = new UnitRoster(null, UnitTeam.team1); UnitEntity mu = new UnitEntity(); Assert.IsTrue(roster.AddUnit(mu), "Roster add unit was not successful"); }
public void TestAddRoster() { UnitBook book = new UnitBook(UnitTeam.team1); UnitRoster rosterOne = new UnitRoster(null, UnitTeam.team1); UnitEntity mu1 = new UnitEntity(); rosterOne.AddUnit(mu1); //expect success the first time Assert.IsTrue(book.AddRoster(rosterOne, TeamRelation.player), "Roster not added to GameMap"); //and failure the next Assert.IsFalse(book.AddRoster(rosterOne, TeamRelation.player), "Duplicate roster added"); UnitRoster rosterTwo = new UnitRoster(null, UnitTeam.team2); UnitEntity mu2 = new UnitEntity(); rosterTwo.AddUnit(mu2); Assert.IsTrue(book.AddRoster(rosterTwo, TeamRelation.enemy), "second roster not successfully added"); }