private async Task<string> ExecuteJoinGameCommand(JoinGameCommand joinGameCommand) { var joinGameContent = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("gameId", joinGameCommand.GameId) }); var response = await this.Requester.HttpClient.PostAsync(JoinGameEndPoint, joinGameContent); if (!response.IsSuccessStatusCode) { throw ApiException.Create(response); } return response.Content.ReadAsStringAsync().Result; }
private JoinGameCommand CreateJoinGameCommand(string[] commandComponenets) { if (commandComponenets.Length != JoinGameCommandParametersCount) { throw new InvalidOperationException(JoinGameCommandParametersCountErrorMessage); } var gameId = commandComponenets[1]; var command = new JoinGameCommand(gameId); return command; }