Ejemplo n.º 1
0
        public void TestInitialize()
        {
            lane  = new Lane(FieldTest.CELLS_NUM);
            unit1 = new Unit(UnitType.SWORDSMEN, PlayerType.PLAYER1);
            unit2 = new Unit(UnitType.SWORDSMEN, PlayerType.PLAYER2);

            lane.AddUnit(unit1);
            lane.AddUnit(unit2);
        }
Ejemplo n.º 2
0
        public void TestIndexers()
        {
            Assert.IsTrue(lane[0].SetEquals(new HashSet <IUnit> {
                unit1
            }));
            Assert.IsTrue(lane[FieldTest.CELLS_NUM - 1].SetEquals(new HashSet <IUnit> {
                unit2
            }));

            lane.Update();

            Assert.IsTrue(lane[1].SetEquals(new HashSet <IUnit> {
                unit1
            }));
            Assert.IsTrue(lane[FieldTest.CELLS_NUM - 2].SetEquals(new HashSet <IUnit> {
                unit2
            }));

            unit1 = new Unit(UnitType.ARCHER, PlayerType.PLAYER1);
            unit2 = new Unit(UnitType.SPEARMEN, PlayerType.PLAYER1);
            lane.AddUnit(unit1);
            lane.AddUnit(unit2);

            Assert.IsTrue(lane[0].SetEquals(new HashSet <IUnit> {
                unit1, unit2
            }));

            try
            {
                var test = this.lane[FieldTest.CELLS_NUM];
                Assert.Fail();
            }
            catch (IndexOutOfRangeException e)
            {
                Assert.IsNotNull(e.Message);
                Assert.IsFalse(e.Message.Length <= 0);
            }
        }
Ejemplo n.º 3
0
        public void TestScoreAndDespawn()
        {
            lane = new Lane(FieldTest.CELLS_NUM);
            lane.AddUnit(unit1);

            for (int i = 0; i < FieldTest.CELLS_NUM; i++)
            {
                Assert.AreEqual(i, lane.GetUnits()[unit1]);
                lane.Update();
            }

            Assert.AreEqual(1, lane.GetScore(PlayerType.PLAYER1));
            Assert.IsFalse(lane.GetUnits().ContainsKey(unit1));
        }
Ejemplo n.º 4
0
 public void TestAddUnitLane()
 {
     lane.AddUnit(unit1);
     Assert.AreEqual(unit1, lane.GetUnits());
     /*Si possono aggiungere altre unita', ma il test cambierebbe cosi. */
 }