public void InvalidMethodVersion_RequestFails()
        {
            var response = DotaApiClient.GetMatchHistoryBySequenceNumAsync(5215439388, version: "v393")
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            Assert.Null(response.Contents);
        }
        public void InvalidApiInterface_RequestFails()
        {
            var response = DotaApiClient.GetMatchHistoryBySequenceNumAsync(808089,
                                                                           count: 1, apiInterface: "IDota_2_matches").Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            Assert.Null(response.Contents);
        }
        public void ValidSeqNum_ReturnsMatchesStartingFromSeqNum(
            ulong seqNum, ulong resultSeqNum)
        {
            var response = DotaApiClient.GetMatchHistoryBySequenceNumAsync(seqNum,
                                                                           count: 1).Result;

            SleepAfterSendingRequest();

            AssertRequestWasSuccessful(response);
            Assert.NotNull(response.Contents);
            Assert.Equal(resultSeqNum, response.Contents.ElementAt(0).MatchSequenceNum);
        }
        public void CountDefined_ReturnsCorrectAmountOfGames(uint count, byte resultCount)
        {
            ulong seqNum   = 55555050;
            var   response = DotaApiClient.GetMatchHistoryBySequenceNumAsync(seqNum,
                                                                             count: count).Result;

            SleepAfterSendingRequest();

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

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

            // Cancel method
            source.Cancel();

            var response = await task;

            SleepAfterSendingRequest();

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