A client for GitHub's Issue Comments API.
See the Issue Comments API documentation for more information.
상속: Octokit.ApiClient, IIssueCommentsClient
예제 #1
0
 public IssuesClient(IApiConnection apiConnection) : base(apiConnection)
 {
     Assignee = new AssigneesClient(apiConnection);
     Events = new IssuesEventsClient(apiConnection);
     Milestone = new MilestonesClient(apiConnection);
     Comment = new IssueCommentsClient(apiConnection);
 }
예제 #2
0
 public IssuesClient(IApiConnection apiConnection) : base(apiConnection)
 {
     Assignee  = new AssigneesClient(apiConnection);
     Events    = new IssuesEventsClient(apiConnection);
     Milestone = new MilestonesClient(apiConnection);
     Comment   = new IssueCommentsClient(apiConnection);
 }
        public void RequestsCorrectUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new IssueCommentsClient(connection);

            client.GetForIssue("fake", "repo", 3);

            connection.Received().GetAll<IssueComment>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/3/comments"));
        }
        public async Task EnsuresNonNullArguments()
        {
            var client = new IssueCommentsClient(Substitute.For<IApiConnection>());

            await AssertEx.Throws<ArgumentNullException>(async () => await client.Get(null, "name", 1));
            await AssertEx.Throws<ArgumentException>(async () => await client.Get("", "name", 1));
            await AssertEx.Throws<ArgumentNullException>(async () => await client.Get("owner", null, 1));
            await AssertEx.Throws<ArgumentException>(async () => await client.Get("owner", "", 1));
        }
        public async Task EnsuresArgumentsNotNull()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new IssueCommentsClient(connection);

            await AssertEx.Throws<ArgumentNullException>(async () => await client.GetForRepository(null, "name"));
            await AssertEx.Throws<ArgumentException>(async () => await client.GetForRepository("", "name"));
            await AssertEx.Throws<ArgumentNullException>(async () => await client.GetForRepository("owner", null));
            await AssertEx.Throws<ArgumentException>(async () => await client.GetForRepository("owner", ""));
        }
        public async Task EnsuresArgumentsNotNull()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new IssueCommentsClient(connection);

            await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForIssue(null, "name", 1));
            await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForIssue("", "name", 1));
            await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForIssue("owner", null, 1));
            await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForIssue("owner", "", 1));
        }
        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 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 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"));
        }
        public void PostsToCorrectUrl()
        {
            const string issueCommentUpdate = "Worthwhile update";
            var connection = Substitute.For<IApiConnection>();
            var client = new IssueCommentsClient(connection);

            client.Update("fake", "repo", 42, issueCommentUpdate);

            connection.Received().Patch<IssueComment>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/comments/42"), Arg.Any<object>());
        }