public Create ( long repositoryId, int number, string newComment ) : Task |
||
repositoryId | long | The Id of the repository |
number | int | The number of the issue |
newComment | string | The new comment to add to the issue |
Результат | Task |
public void PostsToCorrectUrl() { const string newComment = "some title"; var connection = Substitute.For<IApiConnection>(); var client = new IssueCommentsClient(connection); client.Create("fake", "repo", 1, newComment); connection.Received().Post<IssueComment>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/1/comments"), Arg.Any<object>()); }
public async Task EnsuresArgumentsNotNull() { var connection = Substitute.For<IApiConnection>(); var client = new IssueCommentsClient(connection); await AssertEx.Throws<ArgumentNullException>(async () => await client.Create(null, "name", 1, "title")); await AssertEx.Throws<ArgumentException>(async () => await client.Create("", "name", 1, "x")); await AssertEx.Throws<ArgumentNullException>(async () => await client.Create("owner", null, 1, "x")); await AssertEx.Throws<ArgumentException>(async () => await client.Create("owner", "", 1, "x")); await AssertEx.Throws<ArgumentNullException>(async () => await client.Create("owner", "name", 1, null)); }