public void InvalidApiInterface_RequestFails() { var response = DotaApiClient.GetHeroesAsync(apiInterface: "IDota_2_Heroes") .Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
public void InvalidMethodVersion_RequestFails() { var response = DotaApiClient.GetHeroesAsync(version: "v1.2.3") .Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
public void DefaultParams_ReturnsHeroes() { var response = DotaApiClient.GetHeroesAsync() .Result; SleepAfterSendingRequest(); AssertRequestWasSuccessful(response); Assert.NotNull(response.Contents); Assert.NotEmpty(response.Contents); Assert.All(response.Contents, hero => { Assert.NotEmpty(hero.LocalizedName); Assert.NotEmpty(hero.Name); Assert.NotEqual((uint)0, hero.Id); }); }
public async Task MethodGotCancelled_RequestFails() { CancellationTokenSource source = new CancellationTokenSource(); // Start task to be cancelled var task = Task.Run(async() => { return(await DotaApiClient.GetHeroesAsync(cToken: source.Token)); }); // Cancel method source.Cancel(); var response = await task; SleepAfterSendingRequest(); AssertRequestWasCancelled(response); Assert.Null(response.Contents); }