コード例 #1
0
        public async Task CanDismissReview()
        {
            using (var context = await _github.CreateRepositoryContext("test-repo"))
            {
                await _github.CreateTheWorld(context.Repository);

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

                var createdReview = await _github.CreatePullRequestReview(context.Repository, pullRequest.Number, "A pending review", PullRequestReviewEvent.RequestChanges);

                var dismissedReview = await _client.Dismiss(context.RepositoryOwner, context.RepositoryName, pullRequest.Number, createdReview.Id, new PullRequestReviewDismiss { Message = "No soup for you!" });

                Assert.Equal(PullRequestReviewState.Dismissed, dismissedReview.State);
            }
        }
コード例 #2
0
        public async Task CanDeleteReview()
        {
            using (var context = await _github.CreateRepositoryContext("test-repo"))
            {
                await _github.CreateTheWorld(context.Repository);

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

                var createdReview = await _github.CreatePullRequestReview(context.Repository, pullRequest.Number, "A pending review");

                await _client.Delete(context.RepositoryOwner, context.RepositoryName, pullRequest.Number, createdReview.Id);

                var retrievedReviews = await _client.GetAll(context.RepositoryOwner, context.RepositoryName, pullRequest.Number);

                Assert.False(retrievedReviews.Any(x => x.Id == createdReview.Id));
            }
        }
コード例 #3
0
        public async Task CanSubmitCommentedReview()
        {
            using (var context = await _github.CreateRepositoryContext("test-repo"))
            {
                await _github.CreateTheWorld(context.Repository);

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

                var createdReview = await _github.CreatePullRequestReview(context.Repository, pullRequest.Number, "A pending review");

                var submitMessage = new PullRequestReviewSubmit
                {
                    Body  = "Roger roger!",
                    Event = PullRequestReviewEvent.Comment
                };
                var submittedReview = await _client.Submit(context.RepositoryOwner, context.RepositoryName, pullRequest.Number, createdReview.Id, submitMessage);

                Assert.Equal("Roger roger!", submittedReview.Body);
                Assert.Equal(PullRequestReviewState.Commented, submittedReview.State);
            }
        }