Ejemplo n.º 1
0
        public void TestGetUnitsInfo()
        {
            UnitRoster playerUnits = session.GetPlayerUnits();

            Assert.IsTrue(playerUnits.GetAllUnits().Count == 3, "Found more units than expected. (Expecting 3)");

            Assert.AreEqual(playerUnits.GetAllUnits().Find(s => s.InternalName.Equals("Hector")).InternalName, "Hector", "Could not find Hector");
            Assert.AreEqual(playerUnits.GetAllUnits().Find(s => s.InternalName.Equals("Eliwood")).InternalName, "Eliwood", "Could not find Eliwood");
            Assert.AreEqual(playerUnits.GetAllUnits().Find(s => s.InternalName.Equals("Serra")).InternalName, "Serra", "Could not find Serra");

            UnitRoster playerUnits2 = session.GetUnits(UnitTeam.team1);

            Assert.IsTrue(playerUnits2.GetAllUnits().Count == 3, "2 Found more units than expected. (Expecting 3)");

            Assert.AreEqual(playerUnits2.GetAllUnits().Find(s => s.InternalName.Equals("Hector")).InternalName, "Hector", "2 Could not find Hector");
            Assert.AreEqual(playerUnits2.GetAllUnits().Find(s => s.InternalName.Equals("Eliwood")).InternalName, "Eliwood", "2 Could not find Eliwood");
            Assert.AreEqual(playerUnits2.GetAllUnits().Find(s => s.InternalName.Equals("Serra")).InternalName, "Serra", "2 Could not find Serra");


            UnitRoster enemyUnits = session.GetUnits(UnitTeam.team2);

            Assert.IsTrue(enemyUnits.GetAllUnits().Count == 4, "Found more units than expected. (Expecting 4)");

            Assert.AreEqual(enemyUnits.GetAllUnits().Find(s => s.InternalName.Equals("Erik")).InternalName, "Erik", "Could not find Erik");

            try
            {
                UnitRoster noSuchTeam = session.GetUnits(UnitTeam.team5);
            }
            catch (Exception ex)
            {
                Assert.IsInstanceOfType(ex, typeof(KeyNotFoundException), "Able to get roster for non-existing team");
            }
        }
Ejemplo n.º 2
0
        public void TestEndTurn()
        {
            session.StartTurn(session.PlayerTeam);

            UnitRoster playerUnits = session.GetPlayerUnits();

            foreach (UnitEntity ue in playerUnits.GetAllUnits())
            {
                Assert.IsTrue(ue.HasActed == false, "2 Unit not ready to act");
            }

            session.EndPlayerTurn();

            playerUnits = session.GetPlayerUnits();
            foreach (UnitEntity ue in playerUnits.GetAllUnits())
            {
                Assert.IsTrue(ue.HasActed == true, "3 Unit still waiting to act");
            }
        }
Ejemplo n.º 3
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");
        }
Ejemplo n.º 4
0
        public void TestStartTurn()
        {
            session.StartTurn(UnitTeam.team1);

            UnitRoster playerUnits = session.GetPlayerUnits();

            foreach (UnitEntity ue in playerUnits.GetAllUnits())
            {
                Assert.IsTrue(ue.HasActed == false, "Unit not ready to act");
            }
        }
Ejemplo n.º 5
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");
        }