public void BattleServiceShould_DestroyShipAndFinishGame()
        {
            var oneCellShipCoords = new Coordinates(0, 0, "1A");
            var shipCoords        = new ShipCoordinates(oneCellShipCoords, oneCellShipCoords);

            _creationService.CreateShips(new [] { shipCoords });
            var result = _battleService.TakeShot(oneCellShipCoords);

            Assert.That(result.IsDestroyed, Is.True);
            Assert.That(result.IsKnocked, Is.True);
            Assert.That(result.IsEndOfTheGame, Is.True);
        }
 public ActionResult CreateShips(ShipModel shipModel)
 {
     if (shipModel == null || string.IsNullOrEmpty(shipModel.Coordinates))
     {
         return(BadRequest());
     }
     try
     {
         var shipsCoords = _coordinatesParser.ParseShipsCoordinates(shipModel.Coordinates,
                                                                    _game.Matrix.Size);
         _creationService.CreateShips(shipsCoords);
     }
     catch (BadCoordinatesException e)
     {
         _game.ResetMatrixWithShips();
         return(BadRequest(e.ToString()));
     }
     return(Ok());
 }
 public void CreationServiceShould_CreateNotIntersectedShips(ShipCoordinates[] shipsCoords)
 {
     _creationService.CreateShips(shipsCoords);
     Assert.That(_game.Ships.Count, Is.EqualTo(2));
 }