Beispiel #1
0
        public void DefaultParams_ReturnsItemInfos()
        {
            var response = DotaApiClient.GetItemInfosAsync()
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestWasSuccessful(response);
            Assert.NotNull(response.Contents);
            Assert.NotEmpty(response.Contents);
            Assert.All(response.Contents, item => {
                Assert.True(item.Value.Id != 0);
            });
        }
Beispiel #2
0
        public async Task MethodGotCancelled_RequestFails()
        {
            CancellationTokenSource source = new CancellationTokenSource();

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

            // Cancel method
            source.Cancel();

            var response = await task;

            SleepAfterSendingRequest();

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