public SearchGalleryAdvancedAsync ( string qAll = null, string qAny = null, string qExactly = null, string qNot = null, ImageFileType fileType = null, ImageSize imageSize = null, GallerySortOrder sort = GallerySortOrder.Time, TimeWindow window = TimeWindow.All, int page = null ) : Task |
||
qAll | string | Search for all of these words (and). |
qAny | string | Search for any of these words (or). |
qExactly | string | Search for exactly this word or phrase. |
qNot | string | Exclude results matching this word or phrase. |
fileType | ImageFileType | Show results for a specific file type. |
imageSize | ImageSize | Show results for a specific image size. |
sort | GallerySortOrder | The order that the gallery should be sorted by. Default: Time |
window | TimeWindow | The time period that should be used in filtering requests. Default: Day |
page | int | The data paging number. Default: null |
return | Task |
public async Task SearchGalleryAdvancedAsync_WithQueriesNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new GalleryEndpoint(client); var exception = await Record.ExceptionAsync( async () => await endpoint.SearchGalleryAdvancedAsync().ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); }
public async Task SearchGalleryAdvancedAsync_True() { var mockUrl = "https://api.imgur.com/3/gallery/search/top/week/2?q_all=star+wars&q_any=luke+han+leia&q_exactly=Obi-Wan&q_not=Kirk&q_type=anigif&q_size_px=lrg"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockGalleryEndpointResponses.SearchGalleryAdvanced) }; var client = new ImgurClient("123", "1234"); var endpoint = new GalleryEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var galleries = await endpoint.SearchGalleryAdvancedAsync("star wars", "luke han leia", "Obi-Wan", "Kirk", ImageFileType.Anigif, ImageSize.Lrg, GallerySortOrder.Top, TimeWindow.Week, 2) .ConfigureAwait(false); Assert.True(galleries.Any()); }