public void ThrowsWithNoPendingReview() { var target = new PullRequestSession( CreateRealSessionService(), CreateActor(), CreatePullRequest(), Substitute.For <LocalRepositoryModel>(), "owner", true); Assert.ThrowsAsync <InvalidOperationException>(async() => await target.CancelReview()); }
public async Task IsFalseWhenReviewCancelled() { var currentUser = CreateActor(); var review = CreateReview(author: currentUser, state: PullRequestReviewState.Pending); var pr = CreatePullRequest(review); var target = new PullRequestSession( Substitute.For <IPullRequestSessionService>(), currentUser, pr, Substitute.For <ILocalRepositoryModel>(), "owner", true); Assert.That(target.HasPendingReview, Is.True); await target.CancelReview(); Assert.That(target.HasPendingReview, Is.False); }
public async Task IsFalseWhenReviewCancelled() { var currentUser = Substitute.For <IAccount>(); var pr = CreatePullRequest(); var review = CreatePullRequestReview(currentUser, PullRequestReviewState.Pending); pr.Reviews.Returns(new[] { review }); var target = new PullRequestSession( Substitute.For <IPullRequestSessionService>(), currentUser, pr, Substitute.For <ILocalRepositoryModel>(), "owner", true); Assert.That(target.HasPendingReview, Is.True); await target.CancelReview(); Assert.That(target.HasPendingReview, Is.False); }