public GetGalleryItemCommentsAsync ( string galleryItemId, CommentSortOrder sort = CommentSortOrder.Best ) : Task |
||
galleryItemId | string | The gallery item id. |
sort | CommentSortOrder | The order that comments should be sorted by. |
Résultat | Task |
public async Task GetGalleryItemCommentsAsync_WithGalleryItemIdNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new GalleryEndpoint(client); var exception = await Record.ExceptionAsync( async () => await endpoint.GetGalleryItemCommentsAsync(null).ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); }
public async Task GetGalleryItemCommentsAsync_Equal() { var mockUrl = "https://api.imgur.com/3/gallery/Mxd8cg0/comments/oldest"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockGalleryEndpointResponses.GetGalleryItemComments) }; var client = new ImgurClient("123", "1234"); var endpoint = new GalleryEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var comments = await endpoint.GetGalleryItemCommentsAsync("Mxd8cg0", CommentSortOrder.Oldest).ConfigureAwait(false); Assert.Equal(12, comments.Count()); }