Example #1
0
        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");
        }
Example #2
0
        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");
        }
Example #3
0
        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");
        }
Example #4
0
        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");
        }
Example #5
0
        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");
        }