public void Given_previously_selected_revision_When_single_revision_with_same_author_email_selected_Then_AuthorEmailToHighlight_should_not_change()
        {
            var sut           = new AuthorRevisionHighlighting();
            var currentModule = NewModule();

            sut.ProcessRevisionSelectionChange(currentModule, new[] { NewRevisionWithAuthorEmail(ExpectedAuthorEmail1) });

            sut.ProcessRevisionSelectionChange(currentModule, new[] { NewRevisionWithAuthorEmail(ExpectedAuthorEmail1) });

            sut.AuthorEmailToHighlight.Should().Be(ExpectedAuthorEmail1);
        }
        public void Given_previously_selected_revision_When_single_revision_with_different_author_email_selected_Then_ProcessSelectionChange_should_return_RefreshUserInterface()
        {
            var sut           = new AuthorRevisionHighlighting();
            var currentModule = NewModule();

            sut.ProcessRevisionSelectionChange(currentModule, new[] { NewRevisionWithAuthorEmail(ExpectedAuthorEmail1) });

            var action = sut.ProcessRevisionSelectionChange(currentModule, new[] { NewRevisionWithAuthorEmail(ExpectedAuthorEmail2) });

            action.Should().Be(true);
        }
        public void Given_previously_selected_revision_When_single_revision_with_same_author_email_selected_Then_ProcessSelectionChange_should_return_NoAction()
        {
            var sut           = new AuthorRevisionHighlighting();
            var currentModule = NewModule();

            sut.ProcessRevisionSelectionChange(currentModule, new[] { NewRevisionWithAuthorEmail(ExpectedAuthorEmail1) });

            var action = sut.ProcessRevisionSelectionChange(currentModule, new[] { NewRevisionWithAuthorEmail(ExpectedAuthorEmail1) });

            action.Should().Be(false);
        }
        public void Given_previously_selected_revision_When_no_revision_selected_Then_AuthorEmailToHighlight_should_be_value_of_current_user_email_setting()
        {
            var sut           = new AuthorRevisionHighlighting();
            var currentModule = NewModule();

            currentModule.SetSetting(SettingKeyString.UserEmail, ExpectedAuthorEmail2);
            sut.ProcessRevisionSelectionChange(currentModule, new[] { NewRevisionWithAuthorEmail(ExpectedAuthorEmail1) });

            sut.ProcessRevisionSelectionChange(currentModule, Array.Empty <GitRevision>());

            sut.AuthorEmailToHighlight.Should().Be(ExpectedAuthorEmail2);
        }
        public void Given_previously_selected_revision_When_no_revision_selected_Then_ProcessSelectionChange_should_return_RefreshUserInterface()
        {
            var sut           = new AuthorRevisionHighlighting();
            var currentModule = NewModule();

            currentModule.SetSetting(SettingKeyString.UserEmail, ExpectedAuthorEmail2);
            sut.ProcessRevisionSelectionChange(currentModule, new[] { NewRevisionWithAuthorEmail(ExpectedAuthorEmail1) });

            var action = sut.ProcessRevisionSelectionChange(currentModule, Array.Empty <GitRevision>());

            action.Should().Be(true);
        }
        public void Given_previously_selected_revision_When_multiple_revisions_selected_Then_AuthorEmailToHighlight_should_not_change()
        {
            var sut           = new AuthorRevisionHighlighting();
            var currentModule = NewModule();

            Assert.True(sut.ProcessRevisionSelectionChange(currentModule,
                                                           new[] { NewRevisionWithAuthorEmail(ExpectedAuthorEmail1) }));

            Assert.False(sut.ProcessRevisionSelectionChange(currentModule,
                                                            new[]
            {
                NewRevisionWithAuthorEmail(ExpectedAuthorEmail2),
                NewRevisionWithAuthorEmail(ExpectedAuthorEmail1)
            }));

            sut.AuthorEmailToHighlight.Should().Be(ExpectedAuthorEmail1);
        }
        public void IsHighlighted_should_return_true_if_revision_AuthorEmail_matches_AuthorEmailToHighlight(string authorEmail, string highlightEmail, bool expected)
        {
            var currentModule = NewModule();
            var sut           = new AuthorRevisionHighlighting();

            sut.ProcessRevisionSelectionChange(currentModule, new[] { NewRevisionWithAuthorEmail(highlightEmail) });
            sut.AuthorEmailToHighlight.Should().Be(highlightEmail);

            sut.IsHighlighted(new GitRevision(ObjectId.Random())
            {
                AuthorEmail = authorEmail
            }).Should().Be(expected);
        }
        public void When_multiple_revisions_selected_Then_ProcessSelectionChange_should_return_NoAction()
        {
            var sut           = new AuthorRevisionHighlighting();
            var currentModule = NewModule();

            var action = sut.ProcessRevisionSelectionChange(currentModule,
                                                            new[]
            {
                NewRevisionWithAuthorEmail(ExpectedAuthorEmail1),
                NewRevisionWithAuthorEmail(ExpectedAuthorEmail1)
            });

            action.Should().Be(false);
        }