/// <summary> /// Writes the data of the provided <see cref="ITournament"/> to the <see cref="StringBuilder"/> /// </summary> /// <param name="tournament">The <see cref="ITournament"/> whose data is to be written</param> /// <returns>A <see cref="StringBuilder"/> containing string representation of the provided tournament</returns> private StringBuilder WriteTournamentData(ITournament tournament) { Guard.Argument(tournament, nameof(tournament)).NotNull(); var builder = new StringBuilder(); AddEntityData(tournament, builder); var sport = _taskProcessor.GetTaskResult(tournament.GetSportAsync()); var category = _taskProcessor.GetTaskResult(tournament.GetCategoryAsync()); var currentSeasonInfo = _taskProcessor.GetTaskResult(tournament.GetCurrentSeasonAsync()); var tournamentCoverage = _taskProcessor.GetTaskResult(tournament.GetTournamentCoverage()); var seasons = _taskProcessor.GetTaskResult(tournament.GetSeasonsAsync()); var seasonsIds = seasons == null ? "null" : string.Join(",", seasons.Select(s => s.Id)); var currentSeasonStr = string.Empty; if (currentSeasonInfo != null) { currentSeasonStr = $"[{WriteCurrentSeasonInfoData(currentSeasonInfo)}]"; } builder.Append(" Sport=").Append(sport) .Append(" Category=").Append(category) .Append(" CurrentSeasonInfo=").Append(currentSeasonStr) .Append(" TournamentCoverage=").Append(tournamentCoverage?.LiveCoverage) .Append(" Seasons=[").Append(seasonsIds).Append("]"); return(builder); }