Example #1
0
        public async Task TestGetImageDetails()
        {
            var imgurClient     = AuthenticationHelpers.CreateClientAuthenticatedImgurClient();
            var memeGenEndpoint = new MemeGenEndpoint(imgurClient);
            var response        = await memeGenEndpoint.GetDefaultMemesAsync();

            // Assert the Reponse
            Assert.IsNotNull(response.Data);
            Assert.AreEqual(response.Success, true);
            Assert.AreEqual(response.Status, HttpStatusCode.OK);
        }
        public async Task GetDefaultMemesAsync_True()
        {
            var mockUrl      = "https://api.imgur.com/3/memegen/defaults";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockMemeGenEndpointResponses.GetDefaultMemes)
            };

            var client   = new ImgurClient("123", "1234");
            var endpoint = new MemeGenEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var memes    = await endpoint.GetDefaultMemesAsync().ConfigureAwait(false);

            Assert.True(memes.Any());
        }