mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-05 03:30:34 +00:00
Implemented Delete for IssueCommentsClient
This commit is contained in:
@@ -143,6 +143,32 @@ public class IssueCommentsClientTests
|
||||
}
|
||||
}
|
||||
|
||||
public class TheDeleteMethod
|
||||
{
|
||||
[Fact]
|
||||
public void DeletesCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new IssueCommentsClient(connection);
|
||||
|
||||
client.Delete("fake", "repo", 42);
|
||||
|
||||
connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/comments/42"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresArgumentsNotNullOrEmpty()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new IssueCommentsClient(connection);
|
||||
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Delete(null, "name", 42));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Delete("", "name", 42));
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Delete("owner", null, 42));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Delete("owner", "", 42));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheCtor
|
||||
{
|
||||
[Fact]
|
||||
|
||||
@@ -64,5 +64,15 @@ namespace Octokit
|
||||
/// <param name="commentUpdate">The modified comment</param>
|
||||
/// <returns></returns>
|
||||
Task<IssueComment> Update(string owner, string name, int number, string commentUpdate);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified Issue Comment
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#delete-a-comment</remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="number">The comment number</param>
|
||||
/// <returns></returns>
|
||||
Task Delete(string owner, string name, int number);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,5 +102,21 @@ namespace Octokit
|
||||
|
||||
return ApiConnection.Patch<IssueComment>(ApiUrls.IssueComment(owner, name, number), new BodyWrapper(commentUpdate));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified Issue Comment
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#delete-a-comment</remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="number">The comment number</param>
|
||||
/// <returns></returns>
|
||||
public Task Delete(string owner, string name, int number)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return ApiConnection.Delete(ApiUrls.IssueComment(owner, name, number));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user