public void CannotAddHorizontalBattleshipIfSmallerThanPlan()
        {
            var plain      = new Plain(10, 10);
            var battleship = new Battleships.StateManager.Entities.Battleship(new Position(0, 0), new Position(8, 0));

            Assert.Throws <ArgumentOutOfRangeException>(() => plain.AddBattleship(battleship));
        }
        public GameResult Execute(BattleScenario scenario)
        {
            var plain = new Plain(scenario.Plain.Xsize, scenario.Plain.Ysize);

            try
            {
                foreach (var battleship in scenario.Battleships)
                {
                    _battleService.AddBattleship(plain, new Battleship(battleship.Start, battleship.End));
                }

                var shotResults = scenario.ShotPoints?.Select(shotPoint => _battleService.Shoot(plain, shotPoint)).ToList();

                var hasLost = plain.IsDestroyed();

                return(new GameResult {
                    AttackResults = shotResults, HasLost = hasLost
                });
            }
            catch (Exception e)
            {
                return(new GameResult {
                    IsError = true, Error = e.Message
                });
            }
        }
        public void CanAddBattleshipHorizontal()
        {
            var plain      = new Plain(10, 10);
            var battleship = new Battleships.StateManager.Entities.Battleship(new Position(0, 0), new Position(9, 0));

            plain.AddBattleship(battleship);

            Assert.Equal(1, plain.Battleships.Count);
        }