public void Given_no_previously_selected_revision_When_single_revision_selected_Then_AuthorEmailToHighlight_should_change()
        {
            var sut = new AuthorEmailBasedRevisionHighlighting(); 
            var currentModule = NewModule();

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

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

            var action = sut.ProcessRevisionSelectionChange(currentModule, new[] { NewRevisionWithAuthorEmail(currentModule, ExpectedAuthorEmail1) });
            
            action.Should().Be(AuthorEmailBasedRevisionHighlighting.SelectionChangeAction.RefreshUserInterface);
        } 
        public void Given_previously_selected_revision_When_single_revision_with_same_author_email_selected_Then_ProcessSelectionChange_should_return_NoAction()
        {
            var sut = new AuthorEmailBasedRevisionHighlighting(); 
            var currentModule = NewModule();
            sut.ProcessRevisionSelectionChange(currentModule, new[] { NewRevisionWithAuthorEmail(currentModule, ExpectedAuthorEmail1) });

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

            action.Should().Be(AuthorEmailBasedRevisionHighlighting.SelectionChangeAction.NoAction);
        }
        public void When_multiple_revisions_selected_Then_ProcessSelectionChange_should_return_NoAction()
        {
            var sut = new AuthorEmailBasedRevisionHighlighting(); 
            var currentModule = NewModule();

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

            action.Should().Be(AuthorEmailBasedRevisionHighlighting.SelectionChangeAction.NoAction);
        }
        bool _showFilteredBranchesToolStripMenuItemChecked; // refactoring

        #endregion Fields

        #region Constructors

        public RevisionGrid()
        {
            InitLayout();
            InitializeComponent();

            _parentChildNavigationHistory = new ParentChildNavigationHistory(SetSelectedRevision);
            _revisionHighlighting = new AuthorEmailBasedRevisionHighlighting();

            this.Loading.Image = global::GitUI.Properties.Resources.loadingpanel;

            Translate();

            _revisionGridMenuCommands = new RevisionGridMenuCommands(this);
            _revisionGridMenuCommands.CreateOrUpdateMenuCommands();

            // fill View context menu from MenuCommands
            var viewMenuCommands = _revisionGridMenuCommands.GetViewMenuCommands();
            FillMenuFromMenuCommands(viewMenuCommands, viewToolStripMenuItem);

            // fill Navigate context menu from MenuCommands
            var navigateMenuCommands = _revisionGridMenuCommands.GetNavigateMenuCommands();
            FillMenuFromMenuCommands(navigateMenuCommands, navigateToolStripMenuItem);

            NormalFont = AppSettings.Font;
            Loading.Paint += Loading_Paint;

            Revisions.CellPainting += RevisionsCellPainting;
            Revisions.CellFormatting += RevisionsCellFormatting;
            Revisions.KeyPress += RevisionsKeyPress;
            Revisions.KeyDown += RevisionsKeyDown;
            Revisions.MouseDown += RevisionsMouseDown;

            showMergeCommitsToolStripMenuItem.Checked = AppSettings.ShowMergeCommits;
            BranchFilter = String.Empty;
            SetShowBranches();
            QuickRevisionFilter = "";
            FixedRevisionFilter = "";
            FixedPathFilter = "";
            InMemFilterIgnoreCase = true;
            InMemAuthorFilter = "";
            InMemCommitterFilter = "";
            InMemMessageFilter = "";
            AllowGraphWithFilter = false;
            _quickSearchString = "";
            quickSearchTimer.Tick += QuickSearchTimerTick;

            Revisions.Loading += RevisionsLoading;

            //Allow to drop patch file on revisiongrid
            Revisions.DragEnter += Revisions_DragEnter;
            Revisions.DragDrop += Revisions_DragDrop;
            Revisions.AllowDrop = true;
            Revisions.ColumnHeadersVisible = false;

            IsMessageMultilineDataGridViewColumn.Width = 25;
            IsMessageMultilineDataGridViewColumn.DisplayIndex = 2;

            this.HotkeysEnabled = true;
            try
            {
                SetRevisionsLayout((RevisionGridLayout)AppSettings.RevisionGraphLayout);
            }
            catch
            {
                SetRevisionsLayout(RevisionGridLayout.SmallWithGraph);
            }
        }
        public void AuthorEmailToHighlight_should_be_null_when_no_revision_change_processed_yet()
        {
            var sut = new AuthorEmailBasedRevisionHighlighting();

            sut.AuthorEmailToHighlight.Should().BeNull();
        }
        public void Given_previously_selected_revision_When_no_revision_selected_Then_AuthorEmailToHighlight_should_be_value_of_current_user_email_setting()
        {
            var sut = new AuthorEmailBasedRevisionHighlighting(); 
            var currentModule = NewModule();
            currentModule.SetSetting(SettingKeyString.UserEmail, ExpectedAuthorEmail2);
            sut.ProcessRevisionSelectionChange(currentModule, new[] { NewRevisionWithAuthorEmail(currentModule, ExpectedAuthorEmail1) });

            sut.ProcessRevisionSelectionChange(currentModule, new GitRevision[0]);

            sut.AuthorEmailToHighlight.Should().Be(ExpectedAuthorEmail2);
        }