public void InvalidMethodVersion_RequestFails() { var response = DotaApiClient.GetTournamentPlayerStatsAsync(72312627, 9870, version: "v1.3").Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
public void InvalidApiInterface_RequestFails() { var response = DotaApiClient.GetTournamentPlayerStatsAsync(72312627, 9870, apiInterface: "IProDota").Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
public void NonProId_ReturnsEmptyObject() { var response = DotaApiClient.GetTournamentPlayerStatsAsync(147169892, 9870) .Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
public void InvalidTournamentId_ReturnsEmptyObject() { var response = DotaApiClient.GetTournamentPlayerStatsAsync(147169892, 0) .Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); Assert.True(response.Status == 8); Assert.NotNull(response.StatusDetail); }
[InlineData(26771994, 9870)] // TI8 public void ProPlayerIdProvided_ReturnsMatchesFromEventByPlayer (uint playerId, uint eventId) { var response = DotaApiClient.GetTournamentPlayerStatsAsync(playerId, eventId) .Result; SleepAfterSendingRequest(); AssertRequestWasSuccessful(response); Assert.NotNull(response.Contents); Assert.Equal(playerId, response.Contents.Id32); Assert.NotEmpty(response.Contents.Matches); Assert.NotEmpty(response.Contents.HeroesPlayed); }
[InlineData(19672354, 10749, 66)] // Chen public void HeroIdProvided_ReturnsMatchesWithSpecifiedHero( uint playerId, uint eventId, uint heroId) { var response = DotaApiClient.GetTournamentPlayerStatsAsync(playerId, eventId, heroId: heroId).Result; SleepAfterSendingRequest(); AssertRequestWasSuccessful(response); Assert.NotNull(response.Contents); Assert.Equal(playerId, response.Contents.Id32); Assert.NotEmpty(response.Contents.Matches); Assert.NotEmpty(response.Contents.HeroesPlayed); Assert.All(response.Contents.Matches, (match) => Assert.Equal(heroId, match.HeroId)); }
public async Task MethodGotCancelled_RequestFails() { CancellationTokenSource source = new CancellationTokenSource(); // Start task to be cancelled var task = Task.Run(async() => { return(await DotaApiClient.GetTournamentPlayerStatsAsync(72312627, 9870, cToken: source.Token)); }); // Cancel method source.Cancel(); var response = await task; SleepAfterSendingRequest(); AssertRequestWasCancelled(response); Assert.Null(response.Contents); }