GetGalleryTagAsync() public method

View images for a gallery tag.
/// 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 GetGalleryTagAsync ( string tag, GalleryTagSortOrder sort = GalleryTagSortOrder.Viral, TimeWindow window = TimeWindow.Week, int page = null ) : Task
tag string The name of the tag.
sort GalleryTagSortOrder The order that the images in the gallery tag should be sorted by. Default: Viral
window TimeWindow The time period that should be used in filtering requests. Default: Week
page int The data paging number. Default: null
return Task
コード例 #1
0
        public async Task GetGalleryTagAsync_WithGalleryItemIdNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client);

            var exception =
                await
                    Record.ExceptionAsync(
                        async () => await endpoint.GetGalleryTagAsync(null).ConfigureAwait(false))
                        .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);
        }
コード例 #2
0
        public async Task GetGalleryTagAsync_DefaultParameters_Equal()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/t/cats/viral/week/";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetGalleryTag)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var tag = await endpoint.GetGalleryTagAsync("cats").ConfigureAwait(false);

            Assert.NotNull(tag);
            Assert.Equal(196, tag.Followers);
            Assert.Equal(false, tag.Following);
            Assert.Equal(60, tag.Items.Count());
            Assert.Equal("cats", tag.Name);
            Assert.Equal(10920, tag.TotalItems);
        }