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();
            };
        }