public void InvalidMethodVersion_RequestFails() { var response = DotaApiClient.GetPlayerItemsAsync(76561198107435620, version: "v8.3").Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
public void InvalidApiInterface_RequestFails() { var response = DotaApiClient.GetPlayerItemsAsync(76561198107435620, apiInterface: "IDota_2_Cosmetics").Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
public void PrivateInventory_ReturnsWithStatus15() { var response = DotaApiClient.GetPlayerItemsAsync(76561198059119066) .Result; SleepAfterSendingRequest(); AssertRequestFailed(response); var thrown = response.ThrownException as ApiException; Assert.Equal((uint)15, thrown.ApiStatusCode); }
public void ValidPlayerId_ReturnsPlayersItems(ulong id) { var response = DotaApiClient.GetPlayerItemsAsync(id) .Result; SleepAfterSendingRequest(); AssertRequestWasSuccessful(response); Assert.NotNull(response.Contents); Assert.NotEmpty(response.Contents.Items); Assert.All(response.Contents.Items, item => { Assert.NotEqual((ulong)0, item.Id); }); }
public async Task MethodGotCancelled_RequestFails() { CancellationTokenSource source = new CancellationTokenSource(); // Start task to be cancelled var task = Task.Run(async() => { return(await DotaApiClient.GetPlayerItemsAsync(76561198107435620, cToken: source.Token)); }); // Cancel method source.Cancel(); var response = await task; SleepAfterSendingRequest(); AssertRequestWasCancelled(response); Assert.Null(response.Contents); }