Пример #1
0
        private void InitializeMainMenu()
        {
            _view.OnTestAssembliesLoaded();

            bool isTestRunning  = _model.IsTestRunning;
            bool canCloseOrSave = _model.HasTests && !isTestRunning;

            // File Menu
            _view.NewProjectCommand.Enabled  = !isTestRunning;
            _view.OpenProjectCommand.Enabled = !isTestRunning;
            _view.CloseCommand.Enabled       = canCloseOrSave;
            _view.SaveCommand.Enabled        = canCloseOrSave;
            _view.SaveAsCommand.Enabled      = canCloseOrSave;
            _view.SaveResultsCommand.Enabled = canCloseOrSave && _model.HasResults;
            _view.ReloadTestsCommand.Enabled = canCloseOrSave;
            _view.SelectRuntimeMenu.Enabled  = !isTestRunning && _runtimeSelectionController.AllowRuntimeSelection();
            _view.RecentProjectsMenu.Enabled = !isTestRunning;
            _view.ExitCommand.Enabled        = true;

            PopulateRecentProjectsMenu();

            _view.SelectRuntimeMenu.Popup += () => _runtimeSelectionController.PopulateMenu();

            // Project Menu
            _view.ProjectMenu.Enabled = _view.ProjectMenu.Visible = _model.HasTests;
        }
 public void RuntimeSelection_WhenTestPackageIsNull_NotAllowed()
 {
     Assert.False(_controller.AllowRuntimeSelection());
 }
Пример #3
0
        private void UpdateViewCommands(bool testLoading = false)
        {
            bool testLoaded  = _model.HasTests;
            bool testRunning = _model.IsTestRunning;

            _view.RunButton.Enabled             = testLoaded && !testRunning;
            _view.RunAllCommand.Enabled         = testLoaded && !testRunning;
            _view.RunSelectedCommand.Enabled    = testLoaded && !testRunning;
            _view.RunFailedCommand.Enabled      = testLoaded && !testRunning && _model.HasResults;
            _view.TestParametersCommand.Enabled = testLoaded && !testRunning;

            _view.StopButton.Enabled     = testRunning;
            _view.StopRunCommand.Enabled = testRunning;

            _view.OpenCommand.Enabled         = !testRunning && !testLoading;
            _view.CloseCommand.Enabled        = testLoaded && !testRunning;
            _view.AddTestFilesCommand.Enabled = testLoaded && !testRunning;
            _view.ReloadTestsCommand.Enabled  = testLoaded && !testRunning;
            _view.RuntimeMenu.Enabled         = testLoaded && !testRunning && !testLoading && _runtimeSelectionController.AllowRuntimeSelection();
            _view.RecentFilesMenu.Enabled     = !testRunning && !testLoading;
            _view.ExitCommand.Enabled         = !testLoading;
            _view.SaveResultsCommand.Enabled  = _view.SaveResultsAsMenu.Enabled = !testRunning && !testLoading && _model.HasResults;
        }
Пример #4
0
        private void UpdateViewCommands(bool testLoading = false)
        {
            bool testLoaded  = _model.HasTests;
            bool testRunning = _model.IsTestRunning;

            _view.RunButton.Enabled             = testLoaded && !testRunning;
            _view.RunAllCommand.Enabled         = testLoaded && !testRunning;
            _view.RunSelectedCommand.Enabled    = testLoaded && !testRunning;
            _view.RunFailedCommand.Enabled      = testLoaded && !testRunning && _model.HasResults;
            _view.TestParametersCommand.Enabled = testLoaded && !testRunning;

            _view.StopButton.Visible = _view.StopRunCommand.Visible = true;
            _view.StopButton.Enabled = _view.StopRunCommand.Enabled = testRunning;

            // ForceStop button and command are only visible and enabled briefly,
            // as part of the process of stopping the test run.
            _view.ForceStopButton.Visible = _view.ForceStopCommand.Visible = false;
            _view.ForceStopButton.Enabled = _view.ForceStopCommand.Enabled = false;

            _view.OpenCommand.Enabled         = !testRunning && !testLoading;
            _view.CloseCommand.Enabled        = testLoaded && !testRunning;
            _view.AddTestFilesCommand.Enabled = testLoaded && !testRunning;
            _view.ReloadTestsCommand.Enabled  = testLoaded && !testRunning;
            _view.RuntimeMenu.Enabled         = testLoaded && !testRunning && !testLoading && _runtimeSelectionController.AllowRuntimeSelection();
            _view.RecentFilesMenu.Enabled     = !testRunning && !testLoading;
            _view.ExitCommand.Enabled         = !testLoading;
            _view.SaveResultsCommand.Enabled  = _view.SaveResultsAsMenu.Enabled = !testRunning && !testLoading && _model.HasResults;
        }