public void GetResponseAsync_WithNoApiKey_ThrowsHttpRequestException_With_401Message(string reviewId) { ITmdbEasyClient clientWithNoApiKey = GetTestClient(); var options = GetDefaultOptions(sharedApiKey: null); string queryStringWithNoApiKey = $"review/{reviewId}"; var exception = Assert.ThrowsAsync <HttpRequestException>(() => clientWithNoApiKey.GetResponseAsync <Review>(queryStringWithNoApiKey)); Assert.IsTrue(exception.Message.Contains("401")); }
public async Task GetResponseAsync_WithApiKey_ReturnsResult(string reviewId) { ITmdbEasyClient client = GetTestClient(); var options = GetDefaultOptions(sharedApiKey: null); string queryString = $"review/{reviewId}?api_key={GetApiKey()}"; var result = await client.GetResponseAsync <Review>(queryString); Assert.IsNotNull(result); Assert.AreEqual(reviewId, result.Id); }
public async Task <TmdbEasyModel> ExecuteAsync <TmdbEasyModel>(Request request) { return(await _client.GetResponseAsync <TmdbEasyModel>(request.GetUri()).ConfigureAwait(false)); }
public void GetResponseAsync_NullOrEmptyQuery_ThrowsArgumentException(string query) { ITmdbEasyClient client = GetTestClient(); Assert.ThrowsAsync <ArgumentException>(() => client.GetResponseAsync <Review>(query)); }