public DeleteCommentAsync ( int commentId ) : Task |
||
commentId | int | The comment id. |
리턴 | Task |
public async Task<bool> DeleteCommentAsync(int commentId)
{
if (ApiClient.OAuth2Token == null)
throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);
var url = $"comment/{commentId}";
using (var request = RequestBuilder.CreateRequest(HttpMethod.Delete, url))
{
var deleted = await SendRequestAsync<bool>(request).ConfigureAwait(false);
return deleted;
}
}
public async Task DeleteCommentAsync_WithOAuth2TokenNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new CommentEndpoint(client); var exception = await Record.ExceptionAsync( async () => await endpoint.DeleteCommentAsync(678867866).ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); }