예제 #1
0
        /// <summary>
        /// Writes the data of the provided <see cref="IBasicTournament"/> to the <see cref="StringBuilder"/>
        /// </summary>
        /// <param name="tournament">The <see cref="IBasicTournament"/> whose data is to be written</param>
        /// <returns>A <see cref="StringBuilder"/> containing string representation of the provided season</returns>
        private StringBuilder WriteBasicTournamentData(IBasicTournament 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 competitors    = _taskProcessor.GetTaskResult(tournament.GetCompetitorsAsync());
            var competitorsStr = competitors == null
                ? "null"
                : string.Join(",", competitors.Select(s => s.Id));
            var tournamentCoverage = _taskProcessor.GetTaskResult(tournament.GetTournamentCoverage());

            builder.Append(" Competitors=").Append(competitorsStr)
            .Append(" Sport=").Append(sport)
            .Append(" Category=").Append(category)
            .Append(" TournamentCoverage=").Append(tournamentCoverage?.LiveCoverage);

            return(builder);
        }
예제 #2
0
        /// <summary>
        /// Writes the data of the provided <see cref="IBasicTournament"/> to the <see cref="StringBuilder"/>
        /// </summary>
        /// <param name="tournament">The <see cref="IBasicTournament"/> whose data is to be written</param>
        /// <returns>A <see cref="StringBuilder"/> containing string representation of the provided season</returns>
        private StringBuilder WriteBasicTournamentData(IBasicTournament tournament)
        {
            Contract.Requires(tournament != null);
            Contract.Ensures(Contract.Result <StringBuilder>() != null);

            var builder = new StringBuilder();

            AddEntityData(tournament, builder);

            var sport          = _taskProcessor.GetTaskResult(tournament.GetSportAsync());
            var category       = _taskProcessor.GetTaskResult(tournament.GetCategoryAsync());
            var competitors    = _taskProcessor.GetTaskResult(tournament.GetCompetitorsAsync());
            var competitorsStr = competitors == null
                ? "null"
                : string.Join(",", competitors.Select(s => s.Id));
            var tournamentCoverage = _taskProcessor.GetTaskResult(tournament.GetTournamentCoverage());

            builder.Append(" Competitors=").Append(competitorsStr)
            .Append(" Sport=").Append(sport)
            .Append(" Category=").Append(category)
            .Append(" TournamentCoverage=").Append(tournamentCoverage?.LiveCoverage);

            return(builder);
        }