Esempio n. 1
0
        public void InvalidMethodVersion_RequestFails()
        {
            var response = DotaApiClient.GetRealtimeMatchStatsAsync(_liveMatchServerIds[0],
                                                                    version: "v1.2.3").Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            Assert.Null(response.Contents);
        }
Esempio n. 2
0
        public void InvalidServerIds_ReturnsFailedApiResponse()
        {
            var response = DotaApiClient.GetRealtimeMatchStatsAsync(0)
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            Assert.Null(response.Contents);
        }
Esempio n. 3
0
        public void ValidServerIds_ReturnsRealtimeStats()
        {
            Assert.All(_liveMatchServerIds, serverId =>
            {
                var response = DotaApiClient.GetRealtimeMatchStatsAsync(serverId)
                               .Result;

                SleepAfterSendingRequest();

                AssertRequestWasSuccessful(response);
                Assert.NotNull(response.Contents);
                Assert.NotEmpty(response.Contents.GraphData.GoldGraph);
            });
        }
Esempio n. 4
0
        public async Task MethodGotCancelled_RequestFails()
        {
            CancellationTokenSource source = new CancellationTokenSource();

            // Start task to be cancelled
            var task = Task.Run(async() =>
            {
                return(await DotaApiClient.GetRealtimeMatchStatsAsync(_liveMatchServerIds[0],
                                                                      cToken: source.Token));
            });

            // Cancel method
            source.Cancel();

            var response = await task;

            SleepAfterSendingRequest();

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