public GetRepliesAsync ( int commentId ) : Task |
||
commentId | int | The comment id. |
return | Task |
public async Task<IComment> GetRepliesAsync(int commentId)
{
var url = $"comment/{commentId}/replies";
using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
{
var comment = await SendRequestAsync<Comment>(request).ConfigureAwait(false);
return comment;
}
}
public async Task GetRepliesAsync_True() { var mockUrl = "https://api.imgur.com/3/comment/539556821/replies"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockCommentEndpointResponses.GetCommentReplies) }; var client = new ImgurClient("123", "1234"); var endpoint = new CommentEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var comments = await endpoint.GetRepliesAsync(539556821).ConfigureAwait(false); Assert.True(comments.Children.Count() == 7); }