public void InvalidMethodVersion_RequestFails() { var response = DotaApiClient.GetRealtimeMatchStatsAsync(_liveMatchServerIds[0], version: "v1.2.3").Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
public void InvalidServerIds_ReturnsFailedApiResponse() { var response = DotaApiClient.GetRealtimeMatchStatsAsync(0) .Result; SleepAfterSendingRequest(); AssertRequestFailed(response); Assert.Null(response.Contents); }
public void ValidServerIds_ReturnsRealtimeStats() { Assert.All(_liveMatchServerIds, serverId => { var response = DotaApiClient.GetRealtimeMatchStatsAsync(serverId) .Result; SleepAfterSendingRequest(); AssertRequestWasSuccessful(response); Assert.NotNull(response.Contents); Assert.NotEmpty(response.Contents.GraphData.GoldGraph); }); }
public async Task MethodGotCancelled_RequestFails() { CancellationTokenSource source = new CancellationTokenSource(); // Start task to be cancelled var task = Task.Run(async() => { return(await DotaApiClient.GetRealtimeMatchStatsAsync(_liveMatchServerIds[0], cToken: source.Token)); }); // Cancel method source.Cancel(); var response = await task; SleepAfterSendingRequest(); AssertRequestWasCancelled(response); Assert.Null(response.Contents); }