Ejemplo n.º 1
0
        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"));
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public async Task <TmdbEasyModel> ExecuteAsync <TmdbEasyModel>(Request request)
 {
     return(await _client.GetResponseAsync <TmdbEasyModel>(request.GetUri()).ConfigureAwait(false));
 }
Ejemplo n.º 4
0
        public void GetResponseAsync_NullOrEmptyQuery_ThrowsArgumentException(string query)
        {
            ITmdbEasyClient client = GetTestClient();

            Assert.ThrowsAsync <ArgumentException>(() => client.GetResponseAsync <Review>(query));
        }