Esempio n. 1
0
        public void GetTopLiveGames_DefaultParams_ReturnsTopLiveGames()
        {
            var topGames = DotaApiClient.GetTopLiveGamesAsync()
                           .Result;

            SleepAfterSendingRequest();

            Assert.NotEmpty(topGames.Contents);
        }
        public void ValidPartnerDefined_ReturnsTopLiveGames(uint partner)
        {
            var response = DotaApiClient.GetTopLiveGamesAsync(partner: partner)
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestWasSuccessful(response);
            Assert.NotNull(response.Contents);
        }
        public void InvalidMethodVersion_RequestFails()
        {
            var response = DotaApiClient.GetTopLiveGamesAsync(version: "v393")
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            Assert.Null(response.Contents);
        }
        public void InvalidApiInterface_RequestFails()
        {
            var response = DotaApiClient.GetTopLiveGamesAsync(apiInterface: "IDota_2_matches")
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            Assert.Null(response.Contents);
        }
        public void GetRealTimeMatchStats_LiveGamesAvailable_RealTimeMatchStats()
        {
            var response = DotaApiClient.GetTopLiveGamesAsync()
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestWasSuccessful(response);
            Assert.NotNull(response.Contents);
        }
        public void InvalidPartnerDefined_RequestFails(uint partner)
        {
            var response = DotaApiClient.GetTopLiveGamesAsync(partner: partner)
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            Assert.Null(response.Contents);
        }
Esempio n. 7
0
        public async Task MethodGotCancelled_RequestFails()
        {
            CancellationTokenSource source = new CancellationTokenSource();

            // Start task to be cancelled
            var task = Task.Run(async() =>
            {
                return(await DotaApiClient.GetTopLiveGamesAsync(cToken: source.Token));
            });

            // Cancel method
            source.Cancel();

            var response = await task;

            SleepAfterSendingRequest();

            AssertRequestWasCancelled(response);
            Assert.Null(response.Contents);
        }
Esempio n. 8
0
        /// <summary>
        /// Setup.
        /// </summary>
        public GetRealtimeMatchStats_Tests(ClientFixture fixture) : base(fixture)
        {
            var response = DotaApiClient.GetTopLiveGamesAsync()
                           .Result;

            SleepAfterSendingRequest();
            if (response.Successful)
            {
                _liveMatchServerIds = response.Contents
                                      .Where(m => m.ServerSteamId != 0)
                                      .Select(m => m.ServerSteamId)
                                      .Take(5)
                                      .ToList();
                if (_liveMatchServerIds.Count == 0)
                {
                    throw new Exception("Can't get live matches from api");
                }
            }
            else
            {
                throw new Exception("Can't get live matches from api");
            }
        }