예제 #1
0
 public IObservable<PullRequestReviewComment> CreatePullRequestReviewComment(
     string owner,
     string name,
     int number,
     string body,
     int inReplyTo)
 {
     var comment = new PullRequestReviewCommentReplyCreate(body, inReplyTo);
     return gitHubClient.PullRequest.ReviewComment.CreateReply(owner, name, number, comment);
 }
예제 #2
0
        public void PullRequestReviewCommentReplyCreateEnsuresArgumentsValue()
        {
            string body      = "body";
            int    inReplyTo = 1;

            var comment = new PullRequestReviewCommentReplyCreate(body, inReplyTo);

            Assert.Equal(body, comment.Body);
            Assert.Equal(inReplyTo, comment.InReplyTo);
        }
            public void PostsToCorrectUrl()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservablePullRequestReviewCommentsClient(gitHubClient);

                var comment = new PullRequestReviewCommentReplyCreate("Comment content", 9);

                client.CreateReply("fakeOwner", "fakeRepoName", 13, comment);

                gitHubClient.PullRequest.Comment.Received().CreateReply("fakeOwner", "fakeRepoName", 13, comment);
            }
예제 #4
0
        public void PostsToCorrectUrl()
        {
            var connection = Substitute.For <IApiConnection>();
            var client     = new PullRequestReviewCommentsClient(connection);

            var comment = new PullRequestReviewCommentReplyCreate("Comment content", 5);

            client.CreateReply("fakeOwner", "fakeRepoName", 13, comment);

            connection.Connection.Received().Post <PullRequestReviewComment>(Arg.Is <Uri>(u => u.ToString() == "repos/fakeOwner/fakeRepoName/pulls/13/comments"),
                                                                             comment, null, null);
        }
예제 #5
0
    public async Task CanCreateReply()
    {
        var pullRequest = await CreatePullRequest(_context);

        const string body     = "Reply me!";
        const int    position = 1;

        var createdComment = await CreateComment(body, position, pullRequest.Sha, pullRequest.Number);

        var reply        = new PullRequestReviewCommentReplyCreate("Replied", createdComment.Id);
        var createdReply = await _client.CreateReply(Helper.UserName, _context.RepositoryName, pullRequest.Number, reply);

        var createdReplyFromGitHub = await _client.GetComment(Helper.UserName, _context.RepositoryName, createdReply.Id);

        AssertComment(createdReplyFromGitHub, reply.Body, position);
    }
            public async Task EnsuresArgumentsNotNull()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservablePullRequestReviewCommentsClient(gitHubClient);

                string body      = "Comment content";
                int    inReplyTo = 7;

                var comment = new PullRequestReviewCommentReplyCreate(body, inReplyTo);

                await AssertEx.Throws <ArgumentNullException>(async() => await client.CreateReply(null, "name", 1, comment));

                await AssertEx.Throws <ArgumentException>(async() => await client.CreateReply("", "name", 1, comment));

                await AssertEx.Throws <ArgumentNullException>(async() => await client.CreateReply("owner", null, 1, comment));

                await AssertEx.Throws <ArgumentException>(async() => await client.CreateReply("owner", "", 1, comment));

                await AssertEx.Throws <ArgumentNullException>(async() => await client.CreateReply("owner", "name", 1, null));
            }
예제 #7
0
        public async Task EnsuresArgumentsNotNull()
        {
            var connection = Substitute.For <IApiConnection>();
            var client     = new PullRequestReviewCommentsClient(connection);

            string body      = "Comment content";
            int    inReplyTo = 7;

            var comment = new PullRequestReviewCommentReplyCreate(body, inReplyTo);

            await Assert.ThrowsAsync <ArgumentNullException>(() => client.CreateReply(null, "fakeRepoName", 1, comment));

            await Assert.ThrowsAsync <ArgumentException>(() => client.CreateReply("", "fakeRepoName", 1, comment));

            await Assert.ThrowsAsync <ArgumentNullException>(() => client.CreateReply("fakeOwner", null, 1, comment));

            await Assert.ThrowsAsync <ArgumentException>(() => client.CreateReply("fakeOwner", "", 1, comment));

            await Assert.ThrowsAsync <ArgumentNullException>(() => client.CreateReply("fakeOwner", "fakeRepoName", 1, null));
        }
            public async Task EnsuresNonNullArguments()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservablePullRequestReviewCommentsClient(gitHubClient);

                string body = "Comment content";
                int inReplyTo = 7;

                var comment = new PullRequestReviewCommentReplyCreate(body, inReplyTo);

                Assert.Throws<ArgumentNullException>(() => client.CreateReply(null, "name", 1, comment));
                Assert.Throws<ArgumentNullException>(() => client.CreateReply("owner", null, 1, comment));
                Assert.Throws<ArgumentNullException>(() => client.CreateReply("owner", "name", 1, null));

                Assert.Throws<ArgumentNullException>(() => client.CreateReply(1, 1, null));

                Assert.Throws<ArgumentException>(() => client.CreateReply("", "name", 1, comment));
                Assert.Throws<ArgumentException>(() => client.CreateReply("owner", "", 1, comment));
            }
            public void PostsToCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservablePullRequestReviewCommentsClient(gitHubClient);

                var comment = new PullRequestReviewCommentReplyCreate("Comment content", 9);

                client.CreateReply(1, 13, comment);

                gitHubClient.PullRequest.ReviewComment.Received().CreateReply(1, 13, comment);
            }
        /// <summary>
        /// Creates a comment on a pull request review as a reply to another comment.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/pulls/comments/#create-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 pull request number</param>
        /// <param name="comment">The comment</param>
        /// <returns>The created <see cref="PullRequestReviewComment"/></returns>
        public IObservable<PullRequestReviewComment> CreateReply(string owner, string name, int number, PullRequestReviewCommentReplyCreate comment)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNull(comment, "comment");

            return _client.CreateReply(owner, name, number, comment).ToObservable();
        }
        /// <summary>
        /// Creates a comment on a pull request review as a reply to another comment.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/pulls/comments/#create-a-comment</remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="number">The pull request number</param>
        /// <param name="comment">The comment</param>
        public IObservable <PullRequestReviewComment> CreateReply(int repositoryId, int number, PullRequestReviewCommentReplyCreate comment)
        {
            Ensure.ArgumentNotNull(comment, "comment");

            return(_client.CreateReply(repositoryId, number, comment).ToObservable());
        }
        /// <summary>
        /// Creates a comment on a pull request review as a reply to another comment.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/pulls/comments/#create-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 pull request number</param>
        /// <param name="comment">The comment</param>
        public IObservable <PullRequestReviewComment> CreateReply(string owner, string name, int number, PullRequestReviewCommentReplyCreate comment)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNull(comment, "comment");

            return(_client.CreateReply(owner, name, number, comment).ToObservable());
        }
        /// <summary>
        /// Creates a comment on a pull request review as a reply to another comment.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/pulls/comments/#create-a-comment</remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="number">The pull request number</param>
        /// <param name="comment">The comment</param>
        public IObservable<PullRequestReviewComment> CreateReply(long repositoryId, int number, PullRequestReviewCommentReplyCreate comment)
        {
            Ensure.ArgumentNotNull(comment, "comment");

            return _client.CreateReply(repositoryId, number, comment).ToObservable();
        }
예제 #14
0
        public Task <PullRequestReviewComment> CreatePullRequestReplyComment(int pullRequestNumber, string body, int inReplyTo)
        {
            var replyComment = new PullRequestReviewCommentReplyCreate(body, inReplyTo);

            return(client.PullRequest.ReviewComment.CreateReply(context.Owner, context.Name, pullRequestNumber, replyComment));
        }