public void SaveGame(MapElementContainer[,] map, PlayerDto playerOne, PlayerDto playerTwo) { var gameStateToSave = _mapper.Map <GameState>(new GameStateDto(_mapElementMapConverter.GetMapElementsFromMap(map), playerOne, playerTwo)); var playerOneFromDb = _playerFinder.GetPlayerById(playerOne.Id); var playerTwoFromDb = _playerFinder.GetPlayerById(playerTwo.Id); playerOneFromDb.GameStates.Add(gameStateToSave); playerTwoFromDb.GameStates.Add(gameStateToSave); _updateService.Update(playerOneFromDb); _updateService.Update(playerTwoFromDb); _updateService.SaveChanges(); }
public void GivenExistingPlayerId_WhenGetPlayerById_ThenReturnsTheCorrectPlayer() { // Act var result = _playerFinder.GetPlayerById(_players.First().Id); // Assert Check.That(result.Name).IsEqualTo("Jani"); }