Reload() public method

public Reload ( ) : void
return void
Esempio n. 1
0
        private void WireUpEvents()
        {
            _model.TestLoaded   += (ea) => InitializeRunCommands();
            _model.TestReloaded += (ea) => InitializeRunCommands();
            _model.TestUnloaded += (ea) => InitializeRunCommands();
            _model.RunStarting  += (ea) => InitializeRunCommands();
            _model.RunFinished  += (ea) => InitializeRunCommands();

            _view.Load += (s, e) => _view.DisplayFormat.SelectedItem = _displayFormat;

            // Run button and dropdowns
            _view.RunButton.Execute += () =>
            {
                // Necessary test because we don't disable the button click
                if (_model.HasTests && !_model.IsTestRunning)
                {
                    _model.RunTests(TestFilter.Empty);
                }
            };
            _view.RunAllCommand.Execute      += () => _model.RunTests(TestFilter.Empty);
            _view.RunSelectedCommand.Execute += () => _model.RunSelectedTest();
            _view.RunFailedCommand.Execute   += () => _model.RunTests(TestFilter.Empty); // NYI
            _view.StopRunCommand.Execute     += () => _model.CancelTestRun();

            // Change of display format
            _view.DisplayFormat.SelectionChanged += () =>
            {
                _displayFormat = _view.DisplayFormat.SelectedItem;
                _model.Settings.Gui.TestTree.DisplayFormat = _displayFormat;

                // Replace the existing display, which functions as an
                // adjunct to the presenter by handling certain events.
                _display = CreateDisplayStrategy(_displayFormat);

                _view.FormatButton.ToolStripItem.ToolTipText = _display.Description;

                _display.Reload();
            };
        }
Esempio n. 2
0
        private void WireUpEvents()
        {
            // Model actions
            _model.TestLoaded += (ea) =>
            {
                _strategy.OnTestLoaded(ea.Test);
                InitializeRunCommands();
                InitializeCategories(ea.Categories);
                _view.ShowCheckBoxesCommand.Checked = Settings.ShowCheckboxes;
            };

            _model.TestReloaded += (ea) =>
            {
                _strategy.OnTestLoaded(ea.Test);
                InitializeRunCommands();
                ApplyCategoryFilter(_view.Category.SelectedCategories.Items, _view.Category.ExcludeCommand.Checked);
            };

            _model.TestUnloaded += (ea) =>
            {
                _strategy.OnTestUnloaded();
                InitializeRunCommands();
            };

            _model.RunStarting += (ea) => InitializeRunCommands();
            _model.RunFinished += (ea) => InitializeRunCommands();

            _model.TestFinished  += (ea) => _strategy.OnTestFinished(ea.Result);
            _model.SuiteFinished += (ea) => _strategy.OnTestFinished(ea.Result);

            // View actions - Initial Load
            _view.Load += (s, e) => SetDefaultDisplayStrategy();

            // View context commands
            _view.Tree.ContextMenu.Popup               += () => _view.RunCheckedCommand.Visible = _view.Tree.CheckBoxes && _view.Tree.CheckedNodes.Count > 0;
            _view.CollapseAllCommand.Execute           += () => _view.CollapseAll();
            _view.ExpandAllCommand.Execute             += () => _view.ExpandAll();
            _view.CollapseToFixturesCommand.Execute    += () => _strategy.CollapseToFixtures();
            _view.ShowCheckBoxesCommand.CheckedChanged += () =>
            {
                _view.RunSelectedCommand.Enabled                  = false;
                _view.Tree.CheckBoxes                             =
                    _view.CheckAllTestsCommand.Visible            =
                        _view.UncheckAllTestsCommand.Visible      =
                            _view.CheckFailedTestsCommand.Visible =
                                Settings.ShowCheckboxes           = _view.ShowCheckBoxesCommand.Checked;
            };
            _view.CheckAllTestsCommand.Execute += () =>
            {
                var treeView = _view.Tree?.Control;
                if (treeView != null)
                {
                    ToggleNodeCheck(treeView.Nodes, true, true);
                }
            };
            _view.UncheckAllTestsCommand.Execute += () =>
            {
                var treeView = _view.Tree?.Control;
                if (treeView != null)
                {
                    ToggleNodeCheck(treeView.Nodes, false, true);
                }
            };
            _view.CheckFailedTestsCommand.Execute += () =>
            {
                var treeView = _view.Tree?.Control;
                if (treeView != null)
                {
                    ToggleNodeCheck(_strategy.GetFailedNodes(), true, true);
                }
            };
            _view.RunContextCommand.Execute += () => _model.RunTests(_selectedTestItem);
            _view.RunCheckedCommand.Execute += RunCheckedTests;

            // Node selected in tree
            _view.Tree.SelectedNodeChanged += (tn) =>
            {
                _selectedTestItem = tn.Tag as ITestItem;
                _view.RunContextCommand.Enabled = (_selectedTestItem as TestNode)?.CanRun() ?? true;
                _model.NotifySelectedItemChanged(_selectedTestItem);
            };

            // Run button and dropdowns
            _view.RunButton.Execute          += () => _model.RunAllTests();
            _view.RunAllCommand.Execute      += () => _model.RunAllTests();
            _view.RunSelectedCommand.Execute += () => _model.RunTests(_selectedTestItem);
            _view.RunFailedCommand.Execute   += () => RunFailedTest();
            _view.StopRunCommand.Execute     += () => _model.CancelTestRun();

            // Change of display format
            _view.DisplayFormat.SelectionChanged += () =>
            {
                SetDisplayStrategy(_view.DisplayFormat.SelectedItem);
                _strategy.Reload();
                ApplyCategoryFilter(_view.Category.SelectedCategories.Items, _view.Category.ExcludeCommand.Checked);
            };

            _view.Category.SelectedCategories.ItemsChanged += (sender, ae) => ApplyCategoryFilter(ae.Value, _view.Category.ExcludeCommand.Checked);
            _view.Category.ExcludeCommand.CheckedChanged   += () => ApplyCategoryFilter(_view.Category.SelectedCategories.Items, _view.Category.ExcludeCommand.Checked);
        }
Esempio n. 3
0
        private void WireUpEvents()
        {
            // Model actions
            _model.TestLoaded += (ea) =>
            {
                _strategy.OnTestLoaded(ea.Test);
                InitializeRunCommands();
            };

            _model.TestReloaded += (ea) =>
            {
                _strategy.OnTestLoaded(ea.Test);
                InitializeRunCommands();
            };

            _model.TestUnloaded += (ea) =>
            {
                _strategy.OnTestUnloaded();
                InitializeRunCommands();
            };

            _model.RunStarting += (ea) => InitializeRunCommands();
            _model.RunFinished += (ea) => InitializeRunCommands();

            _model.SuiteStarting += (ea) => _strategy.OnTestStarted(ea.Test);
            _model.SuiteFinished += (ea) => _strategy.OnTestFinished(ea.Result);

            _model.TestStarting += (ea) => _strategy.OnTestStarted(ea.Test);
            _model.TestFinished += (ea) => _strategy.OnTestFinished(ea.Result);

            // View actions - Initial Load
            _view.Load += (s, e) =>
            {
                SetDefaultDisplayStrategy();
            };

            // View context commands
            _view.Tree.ContextMenu.Popup += () =>
                                            _view.RunCheckedCommand.Visible = _view.Tree.CheckBoxes && _view.Tree.CheckedNodes.Count > 0;
            _view.CollapseAllCommand.Execute           += () => _view.CollapseAll();
            _view.ExpandAllCommand.Execute             += () => _view.ExpandAll();
            _view.CollapseToFixturesCommand.Execute    += () => _strategy.CollapseToFixtures();
            _view.ShowCheckBoxesCommand.CheckedChanged += () => _view.Tree.CheckBoxes = _view.ShowCheckBoxesCommand.Checked;;
            _view.RunContextCommand.Execute            += () =>
            {
                if (_selectedTestItem != null)
                {
                    _model.RunTests(_selectedTestItem);
                }
            };
            _view.RunCheckedCommand.Execute += RunCheckedTests;

            // Node selected in tree
            _view.Tree.SelectedNodeChanged += (tn) =>
            {
                _selectedTestItem = tn.Tag as ITestItem;
                _model.NotifySelectedItemChanged(_selectedTestItem);
            };

            // Run button and dropdowns
            _view.RunButton.Execute += () =>
            {
                // Necessary test because we don't disable the button click
                if (_model.HasTests && !_model.IsTestRunning)
                {
                    _model.RunAllTests();
                }
            };
            _view.RunAllCommand.Execute      += () => _model.RunAllTests();
            _view.RunSelectedCommand.Execute += () => _model.RunTests(_selectedTestItem);
            _view.RunFailedCommand.Execute   += () => _model.RunAllTests(); // NYI
            _view.StopRunCommand.Execute     += () => _model.CancelTestRun();

            // Change of display format
            _view.DisplayFormat.SelectionChanged += () =>
            {
                SetDisplayStrategy(_view.DisplayFormat.SelectedItem);

                _strategy.Reload();
            };
        }
Esempio n. 4
0
        private void WireUpEvents()
        {
            _model.TestLoaded += (ea) => InitializeRunCommands();
            _model.TestReloaded += (ea) => InitializeRunCommands();
            _model.TestUnloaded += (ea) => InitializeRunCommands();
            _model.RunStarting += (ea) => InitializeRunCommands();
            _model.RunFinished += (ea) => InitializeRunCommands();

            _view.Load += (s,e) => _view.DisplayFormat.SelectedItem = _displayFormat;

            // Run button and dropdowns
            _view.RunButton.Execute += () =>
            {
                // Necessary test because we don't disable the button click
                if (_model.HasTests && !_model.IsTestRunning)
                    _model.RunTests(TestFilter.Empty);
            };
            _view.RunAllCommand.Execute += () => _model.RunTests(TestFilter.Empty);
            _view.RunSelectedCommand.Execute += () => _model.RunSelectedTest();
            _view.RunFailedCommand.Execute += () => _model.RunTests(TestFilter.Empty); // NYI
            _view.StopRunCommand.Execute += () => _model.CancelTestRun();

            // Change of display format
            _view.DisplayFormat.SelectionChanged += () =>
            {
                _displayFormat = _view.DisplayFormat.SelectedItem;
                _model.Settings.Gui.TestTree.DisplayFormat = _displayFormat;

                // Replace the existing display, which functions as an 
                // adjunct to the presenter by handling certain events.
                _display = CreateDisplayStrategy(_displayFormat);

                _view.FormatButton.ToolStripItem.ToolTipText = _display.Description;

                _display.Reload();
            };
        }