예제 #1
0
        public void InvalidMethodVersion_RequestFails()
        {
            var response = DotaApiClient.GetItemIconPathAsync("infinite_waves_shoulder",
                                                              version: "v1.2.3").Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            Assert.Null(response.Contents);
        }
예제 #2
0
        public void ItemDefAndInvalidTypeProvided_ThrowsException()
        {
            var response = DotaApiClient.GetItemIconPathAsync("dark_artistry_hair_model",
                                                              iconType: 2).Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            Assert.Null(response.Contents);
        }
예제 #3
0
        public void ItemDefProvided_ReturnsCDNPath(string itemDef)
        {
            var response = DotaApiClient.GetItemIconPathAsync(itemDef)
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestWasSuccessful(response);
            Assert.NotNull(response.Contents);
            Assert.NotEmpty(response.Contents);
            Assert.StartsWith("icons/econ", response.Contents);
        }
예제 #4
0
        public async Task MethodGotCancelled_RequestFails()
        {
            CancellationTokenSource source = new CancellationTokenSource();

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

            // Cancel method
            source.Cancel();

            var response = await task;

            SleepAfterSendingRequest();

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