示例#1
0
        /// <inheritdoc />
        ICollection <Matchup> IDiscoverable <Matchup> .Discover()
        {
            var request  = new MatchDiscoveryRequest();
            var response = this.serviceClient.Send <MatchupCollectionDTO>(request);

            if (response.Content == null || response.Content.Matchups == null)
            {
                return(new Matchup[0]);
            }

            var values = new List <Matchup>(response.Content.Matchups.Count);

            values.AddRange(response.Content.Matchups.Select(value => this.matchupConverter.Convert(value, null)));
            return(values);
        }
示例#2
0
        /// <inheritdoc />
        async Task <ICollection <Matchup> > IDiscoverable <Matchup> .DiscoverAsync(CancellationToken cancellationToken)
        {
            var request  = new MatchDiscoveryRequest();
            var response = await this.serviceClient.SendAsync <MatchupCollectionDTO>(request, cancellationToken).ConfigureAwait(false);

            if (response.Content == null || response.Content.Matchups == null)
            {
                return(new Matchup[0]);
            }

            var values = new List <Matchup>(response.Content.Matchups.Count);

            values.AddRange(response.Content.Matchups.Select(value => this.matchupConverter.Convert(value, null)));
            return(values);
        }
示例#3
0
        /// <inheritdoc />
        Task <ICollection <Matchup> > IDiscoverable <Matchup> .DiscoverAsync(CancellationToken cancellationToken)
        {
            var request = new MatchDiscoveryRequest();

            return(this.serviceClient.SendAsync <MatchupCollectionDataContract>(request, cancellationToken).ContinueWith <ICollection <Matchup> >(task =>
            {
                var response = task.Result;
                if (response.Content == null || response.Content.Matchups == null)
                {
                    return new Matchup[0];
                }

                var values = new List <Matchup>(response.Content.Matchups.Count);
                values.AddRange(response.Content.Matchups.Select(value => this.converterForMatchup.Convert(value, null)));
                return values;
            }, cancellationToken));
        }