public async Task GetAlbumImageAsync_AreEqual()
        {
            var fakeHttpMessageHandler = new FakeHttpMessageHandler();
            var fakeResponse           = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(AlbumEndpointResponses.Imgur.GetAlbumImageResponse)
            };

            fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/album/5F5Cy/image/79MH23L"),
                                                   fakeResponse);

            var client   = new ImgurClient("123", "1234");
            var endpoint = new AlbumEndpoint(client, new HttpClient(fakeHttpMessageHandler));
            var image    = await endpoint.GetAlbumImageAsync("5F5Cy", "79MH23L");

            Assert.IsNotNull(image);

            Assert.AreEqual("79MH23L", image.Id);
            Assert.AreEqual(null, image.Title);
            Assert.AreEqual(null, image.Description);
            Assert.AreEqual(image.DateTime, new DateTimeOffset(new DateTime(2015, 11, 3, 23, 03, 03, DateTimeKind.Utc)));
            Assert.AreEqual("image/png", image.Type);
            Assert.AreEqual(false, image.Animated);
            Assert.AreEqual(609, image.Width);
            Assert.AreEqual(738, image.Height);
            Assert.AreEqual(451530, image.Size);
            Assert.AreEqual(2849, image.Views);
            Assert.AreEqual(1286408970, image.Bandwidth);
            Assert.AreEqual(null, image.Vote);
            Assert.AreEqual(false, image.Favorite);
            Assert.AreEqual(null, image.Nsfw);
            Assert.AreEqual(null, image.Section);
            Assert.AreEqual("http://i.imgur.com/79MH23L.png", image.Link);
        }
        public async Task GetAlbumImageAsync_WithAlbum_AreEqual(IAlbum actualAlbum)
        {
            var client   = new MashapeClient(ClientId, ClientSecret, MashapeKey, OAuth2Token);
            var endpoint = new AlbumEndpoint(client);

            var image = await endpoint.GetAlbumImageAsync(actualAlbum.Id, "uH3kfZP");

            Assert.IsNotNull(image);
            Assert.AreEqual("uH3kfZP", image.Id);
        }
        public async Task GetAlbumImageAsync_WithImageNull_ThrowsArgumentNullException()
        {
            var client   = new ImgurClient("123", "1234");
            var endpoint = new AlbumEndpoint(client);

            var exception =
                await
                Record.ExceptionAsync(
                    async() => await endpoint.GetAlbumImageAsync("PioAxs8", null).ConfigureAwait(false))
                .ConfigureAwait(false);

            Assert.NotNull(exception);
            Assert.IsType <ArgumentNullException>(exception);
        }
 public async Task GetAlbumImageAsync_WithImageNull_ThrowsArgumentNullException()
 {
     var client   = new ImgurClient("123", "1234");
     var endpoint = new AlbumEndpoint(client);
     await endpoint.GetAlbumImageAsync("PioAxs8", null);
 }
Exemple #5
0
 public async void GetImageFromAlbum()
 {
     var client   = new ImgurClient("59b901759d20a52");
     var endpoint = new AlbumEndpoint(client);
     var image    = await endpoint.GetAlbumImageAsync("buW", "ALBUM_ID");
 }