public GetGalleryAsync ( GallerySection section = GallerySection.Hot, GallerySortOrder sort = GallerySortOrder.Viral, TimeWindow window = TimeWindow.Day, int page = null, bool showViral = true ) : Task |
||
section | GallerySection | The gallery section. Default: Hot |
sort | GallerySortOrder | The order that the gallery should be sorted by. Default: Viral |
window | TimeWindow | The time period that should be used in filtering requests. Default: Day |
page | int | The data paging number. Default: null |
showViral | bool | Show or hide viral images from the 'user' section. Default: true |
Результат | Task |
public async Task GetGalleryAsync_DefaultParameters_Any() { var mockUrl = "https://api.imgur.com/3/gallery/hot/viral/day/?showViral=true"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockGalleryEndpointResponses.GetGallery) }; var client = new ImgurClient("123", "1234", MockOAuth2Token); var endpoint = new GalleryEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var gallery = await endpoint.GetGalleryAsync().ConfigureAwait(false); Assert.True(gallery.Any()); }
public async Task GetGalleryAsync_WithUserRisingMonth2ShowViralFalse_Any() { var mockUrl = "https://api.imgur.com/3/gallery/user/rising/month/2?showViral=false"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockGalleryEndpointResponses.GetGallery) }; var client = new ImgurClient("123", "1234", MockOAuth2Token); var endpoint = new GalleryEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var gallery = await endpoint.GetGalleryAsync(GallerySection.User, GallerySortOrder.Rising, TimeWindow.Month, 2, false).ConfigureAwait(false); Assert.True(gallery.Any()); }