public void CountSetToZero_RequestFails() { var response = DotaApiClient.GetMatchHistoryAsync(count: 0) .Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
public void InvalidApiInterface_RequestFails() { var response = DotaApiClient.GetMatchHistoryAsync(apiInterface: "IDota_2_History") .Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
public void InvalidMethodVersion_RequestFails() { var response = DotaApiClient.GetMatchHistoryAsync(version: "v123") .Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
public void CountParamDefined_ReturnsSpecifiedAmount(uint count, uint resultCount) { var response = DotaApiClient.GetMatchHistoryAsync(count: count) .Result; SleepAfterSendingRequest(); AssertRequestWasSuccessful(response); Assert.NotNull(response.Contents); Assert.True(response.Contents.Count == resultCount); }
public void MinPlayersSpecified_ReturnsMatchesWithMinimumPLayerCount(uint minPlayerCount) { var response = DotaApiClient.GetMatchHistoryAsync(minPlayers: minPlayerCount) .Result; SleepAfterSendingRequest(); AssertRequestWasSuccessful(response); Assert.NotNull(response.Contents); Assert.All(response.Contents, match => { Assert.True(match.Players.Count >= minPlayerCount); }); }
public void AccountIdSpecified_ReturnsMatchesWithSpecifiedAccount(uint playerId) { var response = DotaApiClient.GetMatchHistoryAsync(id32: playerId, count: 5) .Result; SleepAfterSendingRequest(); AssertRequestWasSuccessful(response); Assert.NotNull(response.Contents); Assert.All(response.Contents, match => { Assert.Contains(match.Players, (player) => player.Id32 == playerId); }); }
public void SkillLevelSpecified_ReturnsOnlyGamesWithSpecifiedSkill(DotaSkillLevel skillLvl) { var response = DotaApiClient.GetMatchHistoryAsync(skillLevel: skillLvl) .Result; SleepAfterSendingRequest(); AssertRequestWasSuccessful(response); Assert.NotNull(response.Contents); Assert.All(response.Contents, match => { Assert.Equal(match.SkillLevel, (int)skillLvl); }); }
[InlineData(9870)] // The International 2018 public void LeagueIdSpecified_ReturnsMatchesFromSpecifiedLeague(uint leagueId) { var response = DotaApiClient.GetMatchHistoryAsync(leagueId: leagueId) .Result; SleepAfterSendingRequest(); var detailsResponse = DotaApiClient.GetMatchDetailsAsync( response.Contents.ElementAt(0).Id).Result; SleepAfterSendingRequest(); AssertRequestWasSuccessful(response); Assert.NotNull(response.Contents); Assert.Equal(leagueId, detailsResponse.Contents.LeagueId); }
public void HeroSpecified_ReturnsOnlyGamesWithSpecifiedHero(uint heroId) { var response = DotaApiClient.GetMatchHistoryAsync(heroId: heroId, count: 2) .Result; SleepAfterSendingRequest(); AssertRequestWasSuccessful(response); Assert.NotNull(response.Contents); Assert.All(response.Contents, match => { var players = from p in match.Players where p.HeroId == heroId select p; Assert.Contains(players, (player) => player.HeroId == heroId); }); }
public async Task MethodGotCancelled_RequestFails() { CancellationTokenSource source = new CancellationTokenSource(); // Start task to be cancelled var task = Task.Run(async() => { return(await DotaApiClient.GetMatchHistoryAsync(cToken: source.Token)); }); // Cancel method source.Cancel(); var response = await task; SleepAfterSendingRequest(); AssertRequestWasCancelled(response); Assert.Null(response.Contents); }