Ejemplo n.º 1
0
        public void FindNextUnitNoUnitFound()
        {
            IocContainer.Setup();

            UnitList units = new UnitList(new BattleCalculator(new DieRoller()), new TerrainMap(new ShortestPath()));

            units.Add(2, 2, 0, NATIONALITY.Germany);
            units.Add(3, 3, 0, NATIONALITY.Germany);
            units.Add(4, 4, 0, NATIONALITY.Germany);

            var unit = units.FindNextUnit(units[0], NATIONALITY.USA);

            Assert.Null(unit);
        }
Ejemplo n.º 2
0
        public void FindNextUnitWithPreviousUnit()
        {
            IocContainer.Setup();

            var units = new UnitList(new BattleCalculator(new DieRoller()), new TerrainMap(new ShortestPath()));

            units.Add(2, 2, 0, NATIONALITY.Germany);
            units.Add(3, 3, 0, NATIONALITY.USA);
            units.Add(4, 4, 0, NATIONALITY.Germany);

            var unit = units.FindNextUnit(units[0], NATIONALITY.Germany);

            Assert.Equal(units[2].UnitNumber, unit.UnitNumber);
        }
Ejemplo n.º 3
0
        public void FindNextUnitSkipSleepingUnit()
        {
            IocContainer.Setup();

            UnitList units = new UnitList(new BattleCalculator(new DieRoller()), new TerrainMap(new ShortestPath()));

            units.Add(2, 2, 0, NATIONALITY.USA);
            units.Add(3, 3, 0, NATIONALITY.USA);
            units.Add(4, 4, 0, NATIONALITY.USA);

            units[0].Sleep = true;
            units[1].Sleep = true;

            var unit = units.FindNextUnit(units[0], NATIONALITY.USA);

            Assert.Equal(units[2], unit);
        }
Ejemplo n.º 4
0
        public void FindNextUnitSkipUnitWithZeroMoves()
        {
            IocContainer.Setup();

            UnitList units = new UnitList(new BattleCalculator(new DieRoller()), new TerrainMap(new ShortestPath()));

            units.Add(2, 2, 0, NATIONALITY.Germany);
            units.Add(3, 3, 0, NATIONALITY.USA);
            units.Add(4, 4, 0, NATIONALITY.Germany);
            units.Add(4, 5, 0, NATIONALITY.Germany);

            units[2].Movement = 0;
            units[2].UnitHasAttackedThisTurn = true;

            var unit = units.FindNextUnit(units[0], NATIONALITY.Germany);

            Assert.Equal(units[3].UnitNumber, unit.UnitNumber);
        }