public async Task PRNeedsMergeGradesAccepted(string commentText, bool gradesExpected, CommentType commentType)
        {
            var gitHubMock = GitHubClientMockFactory.CreateDefault()
                             .WithOrganizationMemberGet("abcabc", true)
                             .WithPullRequestGet(336882879, 24, GitHubMockData.CreatePullRequest(24, Octokit.ItemState.Open, mergeable: true))
                             .WithNeptunTxtContent("NEPT12");
            var gradeStoreMock = GradeStoreMockFactory.Create();

            var eh     = createHandler(commentType, gitHubMock.CreateFactory(), gradeStoreMock.Object);
            var result = await eh.Execute(getPayloadWithComment(commentType, commentText));

            Assert.IsTrue(result.Result.Contains("grade done", System.StringComparison.InvariantCultureIgnoreCase));
            gitHubMock.GitHubClientMock.Verify(c =>
                                               c.PullRequest.Review.Create(336882879, 24, It.IsAny <Octokit.PullRequestReviewCreate>()),
                                               Times.Once());
            gitHubMock.GitHubClientMock.Verify(c =>
                                               c.PullRequest.Merge(336882879, 24, It.IsAny <Octokit.MergePullRequest>()),
                                               Times.Once());

            gradeStoreMock.Verify(c =>
                                  c.StoreGrade("NEPT12", "org1/repo1", 24, "https://www.github.com/org1/repo1/pull/24", It.IsAny <string>(), @"https://github.com/org1/repo1/pull/1#issuecomment-821112111", It.IsAny <IReadOnlyCollection <double> >()),
                                  gradesExpected ? Times.Once() : Times.Never());
            gradeStoreMock.Verify(c =>
                                  c.ConfirmAutoGrade("NEPT12", "org1/repo1", 24, "https://www.github.com/org1/repo1/pull/24", It.IsAny <string>(), @"https://github.com/org1/repo1/pull/1#issuecomment-821112111"),
                                  gradesExpected ? Times.Never() : Times.Once());
        }
        public async Task CommandNotRecognized(string commentText, CommentType commentType)
        {
            var gitHubMock     = GitHubClientMockFactory.CreateDefault();
            var gradeStoreMock = GradeStoreMockFactory.Create();

            var eh     = createHandler(commentType, gitHubMock.CreateFactory(), gradeStoreMock.Object);
            var result = await eh.Execute(getPayloadWithComment(commentType, commentText));

            Assert.IsTrue(result.Result.Contains("not recognized as command", System.StringComparison.InvariantCultureIgnoreCase));
            gitHubMock.GitHubClientMock.Verify(c =>
                                               c.PullRequest.Get(It.IsAny <long>(), It.IsAny <int>()),
                                               Times.Never());
            gradeStoreMock.Verify(c =>
                                  c.StoreGrade(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IReadOnlyCollection <double> >()),
                                  Times.Never());
            gradeStoreMock.Verify(c =>
                                  c.ConfirmAutoGrade(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()),
                                  Times.Never());
        }
        public async Task PRAlreadyClosedGradesAccepted(CommentType commentType)
        {
            var gitHubMock = GitHubClientMockFactory.CreateDefault()
                             .WithOrganizationMemberGet("abcabc", true)
                             .WithPullRequestGet(336882879, 24, GitHubMockData.CreatePullRequest(24, Octokit.ItemState.Closed, mergeable: false));
            var gradeStoreMock = GradeStoreMockFactory.Create();

            var eh     = createHandler(commentType, gitHubMock.CreateFactory(), gradeStoreMock.Object);
            var result = await eh.Execute(getPayloadWithComment(commentType, @"/ahk ok"));

            Assert.IsTrue(result.Result.Contains("grade done", System.StringComparison.InvariantCultureIgnoreCase));
            gitHubMock.GitHubClientMock.Verify(c =>
                                               c.PullRequest.Merge(It.IsAny <long>(), It.IsAny <int>(), It.IsAny <Octokit.MergePullRequest>()),
                                               Times.Never());
            gradeStoreMock.Verify(c =>
                                  c.StoreGrade(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IReadOnlyCollection <double> >()),
                                  Times.Never());
            gradeStoreMock.Verify(c =>
                                  c.ConfirmAutoGrade("ABC123", "org1/repo1", 24, "https://www.github.com/org1/repo1/pull/24", It.IsAny <string>(), @"https://github.com/org1/repo1/pull/1#issuecomment-821112111"),
                                  Times.Once());
        }
        public async Task ActorIsNotOrgMemberCommandNotAllowed(CommentType commentType)
        {
            var gitHubMock = GitHubClientMockFactory.CreateDefault()
                             .WithOrganizationMemberGet("abcabc", false);
            var gradeStoreMock = GradeStoreMockFactory.Create();

            var eh     = createHandler(commentType, gitHubMock.CreateFactory(), gradeStoreMock.Object);
            var result = await eh.Execute(getPayloadWithComment(commentType, @"/ahk ok"));

            Assert.IsTrue(result.Result.Contains("not allowed for user", System.StringComparison.InvariantCultureIgnoreCase));
            gitHubMock.GitHubClientMock.Verify(c =>
                                               c.PullRequest.Merge(336882879, 24, It.IsAny <Octokit.MergePullRequest>()),
                                               Times.Never());
            gitHubMock.GitHubClientMock.Verify(c =>
                                               c.Organization.Member.CheckMember("org1", "abcabc"),
                                               Times.Once());
            gradeStoreMock.Verify(c =>
                                  c.StoreGrade(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IReadOnlyCollection <double> >()),
                                  Times.Never());
            gradeStoreMock.Verify(c =>
                                  c.ConfirmAutoGrade(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()),
                                  Times.Never());
        }