public void InvalidApiInterface_RequestFails()
        {
            var response = DotaApiClient.GetMatchDetailsAsync(5215439388, apiInterface: "IDota_2_matches")
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            Assert.Null(response.Contents);
        }
        public void ValidMatchIds_ReturnsCorrectMatches(ulong matchId)
        {
            var response = DotaApiClient.GetMatchDetailsAsync(matchId)
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestWasSuccessful(response);
            Assert.NotNull(response.Contents);
            Assert.Equal(matchId, response.Contents.MatchId);
        }
Esempio n. 3
0
        [InlineData(9870)]  // The International 2018
        public void LeagueIdSpecified_ReturnsMatchesFromSpecifiedLeague(uint leagueId)
        {
            var response = DotaApiClient.GetMatchHistoryAsync(leagueId: leagueId)
                           .Result;

            SleepAfterSendingRequest();
            var detailsResponse = DotaApiClient.GetMatchDetailsAsync(
                response.Contents.ElementAt(0).Id).Result;

            SleepAfterSendingRequest();

            AssertRequestWasSuccessful(response);
            Assert.NotNull(response.Contents);
            Assert.Equal(leagueId, detailsResponse.Contents.LeagueId);
        }
        public async Task MethodGotCancelled_RequestFails()
        {
            CancellationTokenSource source = new CancellationTokenSource();

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

            // Cancel method
            source.Cancel();

            var response = await task;

            SleepAfterSendingRequest();

            AssertRequestWasCancelled(response);
            Assert.Null(response.Contents);
        }