GetAlbumImageAsync() public method

Get information about an image in an album.
/// Thrown when a null reference is passed to a method that does not accept it as a /// valid argument. /// Thrown when an error is found in a response from an Imgur endpoint. Thrown when an error is found in a response from a Mashape endpoint.
public GetAlbumImageAsync ( string imageId, string albumId ) : Task
imageId string The image id.
albumId string The album id.
return Task
コード例 #1
0
        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);
        }
コード例 #2
0
        public async Task GetAlbumImageAsync_Equal()
        {
            var mockUrl = "https://api.imgur.com/3/album/5F5Cy/image/79MH23L";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockAlbumEndpointResponses.Imgur.GetAlbumImage)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new AlbumEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var image = await endpoint.GetAlbumImageAsync("79MH23L", "5F5Cy").ConfigureAwait(false);

            Assert.NotNull(image);

            Assert.Equal("79MH23L", image.Id);
            Assert.Equal(null, image.Title);
            Assert.Equal(null, image.Description);
            Assert.Equal(image.DateTime, new DateTimeOffset(new DateTime(2015, 11, 3, 23, 03, 03, DateTimeKind.Utc)));
            Assert.Equal("image/png", image.Type);
            Assert.Equal(false, image.Animated);
            Assert.Equal(609, image.Width);
            Assert.Equal(738, image.Height);
            Assert.Equal(451530, image.Size);
            Assert.Equal(2849, image.Views);
            Assert.Equal(1286408970, image.Bandwidth);
            Assert.Equal(null, image.Vote);
            Assert.Equal(false, image.Favorite);
            Assert.Equal(null, image.Nsfw);
            Assert.Equal(null, image.Section);
            Assert.Equal("http://i.imgur.com/79MH23L.png", image.Link);
        }