public void FindUnit()
        {
            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);

            var unit = units.FindUnit(3, 3);

            Assert.Equal(NATIONALITY.USA, unit.Nationality);
        }
Example #2
0
        public void ShouldFindMonster()
        {
            var unitList = new UnitList();
            var player   = new Player()
            {
                CurrentLocation = new Location(1, 0, 0)
            };
            var monsterTwo = new Monster()
            {
                CurrentLocation = new Location(3, 0, 0)
            };

            unitList.Add(player);
            unitList.Add(monsterTwo);

            var foundUnit = unitList.FindUnit(new Location(3, 0, 0));

            Assert.True(foundUnit is Monster);
        }
Example #3
0
        public void ShouldNotFind()
        {
            var unitList = new UnitList();
            var player   = new Player()
            {
                CurrentLocation = new Location(1, 0, 0)
            };
            var monsterTwo = new Monster()
            {
                CurrentLocation = new Location(3, 0, 0)
            };

            unitList.Add(player);
            unitList.Add(monsterTwo);

            var foundUnit = unitList.FindUnit(new Location(2, 2, 2));

            Assert.Null(foundUnit);
        }
Example #4
0
        public void ShouldFindTwo()
        {
            var unitList = new UnitList();
            var player   = new Player()
            {
                CurrentLocation = new Location(1, 0, 0)
            };
            var monsterOne = new Monster()
            {
                CurrentLocation = new Location(2, 0, 0)
            };
            var monsterTwo = new Monster()
            {
                CurrentLocation = new Location(3, 0, 0)
            };

            unitList.Add(player);
            unitList.Add(monsterOne);
            unitList.Add(monsterTwo);

            var foundUnits = unitList.FindUnit(typeof(Monster));

            Assert.True(foundUnits.Count() == 2);
        }