public void InvalidMethodVersion_RequestFails() { var response = DotaApiClient.GetItemIconPathAsync("infinite_waves_shoulder", version: "v1.2.3").Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
public void ItemDefAndInvalidTypeProvided_ThrowsException() { var response = DotaApiClient.GetItemIconPathAsync("dark_artistry_hair_model", iconType: 2).Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
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); }
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); }