public async Task GetFilteredOutGalleryAsync_DefaultParameters_NotNull() { var mockUrl = "https://api.imgur.com/3/g/filtered/viral/week/"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockCustomGalleryEndpointResponses.GetFilteredOutGallery) }; var client = new ImgurClient("123", "1234", MockOAuth2Token); var endpoint = new CustomGalleryEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var gallery = await endpoint.GetFilteredOutGalleryAsync().ConfigureAwait(false); Assert.NotNull(gallery); Assert.Equal("imgurapidotnet", gallery.AccountUrl); Assert.Equal(60, gallery.ItemCount); Assert.Equal(60, gallery.Items.Count()); Assert.Equal("https://imgur.com/filtered", gallery.Link); Assert.Equal(2, gallery.Tags.Count()); }
public async Task GetFilteredOutGalleryAsync_WithOAuth2TokenNull_ThrowsArgumentNullException() { var mockUrl = "https://api.imgur.com/3/g/custom/top/month/1"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockCustomGalleryEndpointResponses.GetFilteredOutGallery) }; var client = new ImgurClient("123", "1234"); var endpoint = new CustomGalleryEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var exception = await Record.ExceptionAsync( async() => await endpoint.GetFilteredOutGalleryAsync(CustomGallerySortOrder.Top, TimeWindow.Month, 1) .ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType <ArgumentNullException>(exception); }