Esempio n. 1
0
        public void PostBattleResultsTest()
        {
            BattleResults.Messages.Clear();
            IBattleField battleField = SetUpBattleField();

            battleField.StartBattle();
            var br1 = battleField.WorkingFleets.FirstOrDefault().WorkingStarShips.Count();

            BattleResults.Messages.Clear();
            battleField = SetUpBattleField();
            battleField.StartBattle();
            var br2 = battleField.WorkingFleets.FirstOrDefault().WorkingStarShips.Count();

            BattleResults.Messages.Clear();
            battleField = SetUpBattleField();
            battleField.StartBattle();
            var  br3 = battleField.WorkingFleets.FirstOrDefault().WorkingStarShips.Count();
            bool allThreeAreDiffrent = br1 != br2 && br2 != br3 && br1 != br3;

            Assert.True(allThreeAreDiffrent);
        }
        public void StartBattleTest()
        {
            IBattleField battleField = BattleFieldFactory.CreateBattleField(BattleFieldType.Large);
            IFleet       fleet1      = FleetFactory.CreateFleet(FleetConfigurationType.SmallShips, BattleStratageyType.WeekShipsFirst);
            IFleet       fleet2      = FleetFactory.CreateFleet(FleetConfigurationType.BalancedShips, BattleStratageyType.StrongShipsFirst);
            IFleet       fleet3      = FleetFactory.CreateFleet(FleetConfigurationType.HeavyShips, BattleStratageyType.NoPriority);
            IFleet       fleet4      = FleetFactory.CreateFleet(FleetConfigurationType.BalancedShips, BattleStratageyType.WeekShipsFirst);
            IFleet       fleet5      = FleetFactory.CreateFleet(FleetConfigurationType.BalancedShips, BattleStratageyType.NoPriority);
            IFleet       fleet6      = FleetFactory.CreateFleet(FleetConfigurationType.BalancedShips, BattleStratageyType.NoPriority);

            fleet1.EnterField(battleField);
            fleet2.EnterField(battleField);
            fleet3.EnterField(battleField);
            fleet4.EnterField(battleField);
            fleet5.EnterField(battleField);
            fleet6.EnterField(battleField);
            battleField.StartBattle();
            Assert.True(battleField.Fleets.Where(x => x.WorkingStarShips.Count() > 0).Count() == 1);
            bool result = battleField.CheckForVictory();

            Assert.True(result);
        }