/// <summary>
 /// Creates a pull request review.
 /// </summary>
 /// <remarks>https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review</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="review">The review</param>
 public IObservable <PullRequestReview> Create(string owner, string name, int number, PullRequestReviewCreate review)
 {
     Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
     Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
     Ensure.ArgumentNotNull(review, nameof(review));
     return(_client.Create(owner, name, number, review).ToObservable());
 }
Exemple #2
0
        public async Task CanCreatePendingReview()
        {
            using (var context = await _github.CreateRepositoryContext("test-repo"))
            {
                await _github.CreateTheWorld(context.Repository);

                var pullRequest = await _github2.CreatePullRequest(context.Repository);

                var body = "A review comment message";

                var review = new PullRequestReviewCreate()
                {
                    CommitId = pullRequest.Head.Sha,
                    Body     = body,
                    Comments = new List <DraftPullRequestReviewComment>
                    {
                        new DraftPullRequestReviewComment("comment 1", "README.md", 1),
                        new DraftPullRequestReviewComment("comment 2", "README.md", 2)
                    }
                };

                var createdReview = await _client.Create(context.RepositoryOwner, context.RepositoryName, pullRequest.Number, review);

                Assert.NotNull(createdReview);
                Assert.Equal(body, createdReview.Body);
                Assert.Equal(PullRequestReviewState.Pending, createdReview.State);
                Assert.Equal(pullRequest.Head.Sha, createdReview.CommitId);
            }
        }