示例#1
0
        public void DefaultParams_ReturnsLeagueListing()
        {
            var response = DotaApiClient.GetLeagueListingAsync()
                           .Result;

            AssertRequestWasSuccessful(response);
            Assert.NotNull(response.Contents);
            Assert.NotEmpty(response.Contents);
        }
示例#2
0
        public void InvalidMethodVersion_RequestFails()
        {
            var response = DotaApiClient.GetLeagueListingAsync(version: "v1.2.3")
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            Assert.Null(response.Contents);
        }
示例#3
0
        public async Task MethodGotCancelled_RequestFails()
        {
            CancellationTokenSource source = new CancellationTokenSource();

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

            // Cancel method
            source.Cancel();

            var response = await task;

            SleepAfterSendingRequest();

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