Esempio n. 1
0
        public TestExplorerViewModel(IVBE vbe,
                                     RubberduckParserState state,
                                     ITestEngine testEngine,
                                     TestExplorerModel model,
                                     IClipboardWriter clipboard,
                                     IGeneralConfigService configService,
                                     ISettingsFormFactory settingsFormFactory,
                                     IMessageBox messageBox)
        {
            _vbe        = vbe;
            _state      = state;
            _testEngine = testEngine;
            _testEngine.TestCompleted += TestEngineTestCompleted;
            Model                = model;
            _clipboard           = clipboard;
            _settingsFormFactory = settingsFormFactory;
            _messageBox          = messageBox;

            _navigateCommand = new NavigateCommand(_state.ProjectsProvider);

            RunAllTestsCommand = new RunAllTestsCommand(vbe, state, testEngine, model, null);
            RunAllTestsCommand.RunCompleted += RunCompleted;

            AddTestModuleCommand      = new AddTestModuleCommand(vbe, state, configService, _messageBox);
            AddTestMethodCommand      = new AddTestMethodCommand(vbe, state);
            AddErrorTestMethodCommand = new AddTestMethodExpectedErrorCommand(vbe, state);

            RefreshCommand              = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRefreshCommand, CanExecuteRefreshCommand);
            RepeatLastRunCommand        = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRepeatLastRunCommand, CanExecuteRepeatLastRunCommand);
            RunNotExecutedTestsCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunNotExecutedTestsCommand, CanExecuteRunNotExecutedTestsCommand);
            RunInconclusiveTestsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunInconclusiveTestsCommand, CanExecuteRunInconclusiveTestsCommand);
            RunFailedTestsCommand       = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunFailedTestsCommand, CanExecuteRunFailedTestsCommand);
            RunPassedTestsCommand       = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunPassedTestsCommand, CanExecuteRunPassedTestsCommand);
            RunSelectedTestCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteSelectedTestCommand, CanExecuteSelectedTestCommand);

            CopyResultsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand);

            OpenTestSettingsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), OpenSettings);

            SetOutcomeGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByOutcome  = (bool)param;
                GroupByLocation = !(bool)param;
            });

            SetLocationGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByLocation = (bool)param;
                GroupByOutcome  = !(bool)param;
            });
        }
Esempio n. 2
0
        public TestExplorerViewModel(VBE vbe,
                                     RubberduckParserState state,
                                     ITestEngine testEngine,
                                     TestExplorerModel model,
                                     IClipboardWriter clipboard,
                                     NewUnitTestModuleCommand newTestModuleCommand,
                                     NewTestMethodCommand newTestMethodCommand,
                                     IGeneralConfigService configService,
                                     IOperatingSystem operatingSystem)
        {
            _state      = state;
            _testEngine = testEngine;
            _testEngine.TestCompleted += TestEngineTestCompleted;
            _model           = model;
            _clipboard       = clipboard;
            _configService   = configService;
            _operatingSystem = operatingSystem;

            _navigateCommand = new NavigateCommand();

            _runAllTestsCommand = new RunAllTestsCommand(state, testEngine, model);
            _runAllTestsCommand.RunCompleted += RunCompleted;

            _addTestModuleCommand      = new AddTestModuleCommand(vbe, state, newTestModuleCommand);
            _addTestMethodCommand      = new AddTestMethodCommand(vbe, state, newTestMethodCommand);
            _addErrorTestMethodCommand = new AddTestMethodExpectedErrorCommand(vbe, state, newTestMethodCommand);

            _refreshCommand             = new DelegateCommand(ExecuteRefreshCommand, CanExecuteRefreshCommand);
            _repeatLastRunCommand       = new DelegateCommand(ExecuteRepeatLastRunCommand, CanExecuteRepeatLastRunCommand);
            _runNotExecutedTestsCommand = new DelegateCommand(ExecuteRunNotExecutedTestsCommand, CanExecuteRunNotExecutedTestsCommand);
            _runFailedTestsCommand      = new DelegateCommand(ExecuteRunFailedTestsCommand, CanExecuteRunFailedTestsCommand);
            _runPassedTestsCommand      = new DelegateCommand(ExecuteRunPassedTestsCommand, CanExecuteRunPassedTestsCommand);
            _runSelectedTestCommand     = new DelegateCommand(ExecuteSelectedTestCommand, CanExecuteSelectedTestCommand);

            _copyResultsCommand = new DelegateCommand(ExecuteCopyResultsCommand);

            _openTestSettingsCommand = new DelegateCommand(OpenSettings);

            _setOutcomeGroupingCommand = new DelegateCommand(param =>
            {
                GroupByOutcome  = (bool)param;
                GroupByLocation = !(bool)param;
            });

            _setLocationGroupingCommand = new DelegateCommand(param =>
            {
                GroupByLocation = (bool)param;
                GroupByOutcome  = !(bool)param;
            });
        }
        public TestExplorerViewModel(VBE vbe, ITestEngine testEngine, TestExplorerModelBase model, IClipboardWriter clipboard)
        {
            _testEngine = testEngine;
            _testEngine.TestCompleted += TestEngineTestCompleted;
            _model     = model;
            _clipboard = clipboard;

            _navigateCommand = new NavigateCommand();

            _runAllTestsCommand        = new RunAllTestsCommand(testEngine, model);
            _addTestModuleCommand      = new AddTestModuleCommand(vbe);
            _addTestMethodCommand      = new AddTestMethodCommand(vbe, model);
            _addErrorTestMethodCommand = new AddTestMethodExpectedErrorCommand(vbe, model);

            _refreshCommand             = new DelegateCommand(ExecuteRefreshCommand, CanExecuteRefreshCommand);
            _repeatLastRunCommand       = new DelegateCommand(ExecuteRepeatLastRunCommand, CanExecuteRepeatLastRunCommand);
            _runNotExecutedTestsCommand = new DelegateCommand(ExecuteRunNotExecutedTestsCommand, CanExecuteRunNotExecutedTestsCommand);
            _runFailedTestsCommand      = new DelegateCommand(ExecuteRunFailedTestsCommand, CanExecuteRunFailedTestsCommand);
            _runPassedTestsCommand      = new DelegateCommand(ExecuteRunPassedTestsCommand, CanExecuteRunPassedTestsCommand);
            _runSelectedTestCommand     = new DelegateCommand(ExecuteSelectedTestCommand, CanExecuteSelectedTestCommand);

            _copyResultsCommand = new DelegateCommand(ExecuteCopyResultsCommand);
        }
Esempio n. 4
0
        public SolutionViewModel(ISolution model) : base(model)
        {
            shell = IoC.Get <IShell>();

            Projects   = new ObservableCollection <ProjectViewModel>();
            IsExpanded = true;

            Projects.BindCollections(model.Projects, p => { return(ProjectViewModel.Create(this, p)); },
                                     (pvm, p) => pvm.Model == p);

            NewProjectCommand = ReactiveCommand.Create();
            NewProjectCommand.Subscribe(o =>
            {
                shell.ModalDialog = new NewProjectDialogViewModel(model);
                shell.ModalDialog.ShowDialog();
            });

            AddExistingProjectCommand = ReactiveCommand.Create();
            AddExistingProjectCommand.Subscribe(async o =>
            {
                var dlg   = new OpenFileDialog();
                dlg.Title = "Open Project";

                var extensions = new List <string>();

                foreach (var projectType in shell.ProjectTypes)
                {
                    extensions.AddRange(projectType.Extensions);
                }

                dlg.Filters.Add(new FileDialogFilter {
                    Name = "AvalonStudio Project", Extensions = extensions
                });
                dlg.InitialFileName  = string.Empty;
                dlg.InitialDirectory = Model.CurrentDirectory;
                dlg.AllowMultiple    = false;

                var result = await dlg.ShowAsync();

                if (result != null && result.Length == 1)
                {
                    var proj = Solution.LoadProjectFile(model, result[0]);

                    if (proj != null)
                    {
                        model.AddProject(proj);
                        model.Save();
                    }
                }
            });

            OpenInExplorerCommand = ReactiveCommand.Create();
            OpenInExplorerCommand.Subscribe(o => { Platform.OpenFolderInExplorer(model.CurrentDirectory); });

            ConfigurationCommand = ReactiveCommand.Create();
            ConfigurationCommand.Subscribe(o =>
            {
                //Workspace.Instance.ModalDialog = new SolutionConfigurationDialogViewModel(Workspace.Instance.SolutionExplorer.Model);
                //Workspace.Instance.ModalDialog.ShowDialog();
            });

            BuildSolutionCommand = ReactiveCommand.Create();
            BuildSolutionCommand.Subscribe(o => { BuildSolution(); });

            CleanSolutionCommand = ReactiveCommand.Create();
            CleanSolutionCommand.Subscribe(o => { CleanSolution(); });

            RebuildSolutionCommand = ReactiveCommand.Create();
            RebuildSolutionCommand.Subscribe(o =>
            {
                CleanSolution();

                BuildSolution();
            });

            RunAllTestsCommand = ReactiveCommand.Create();
            RunAllTestsCommand.Subscribe(o => { RunTests(); });
        }
 public RunAllTestsCommandMenuItem(RunAllTestsCommand command)
     : base(command)
 {
 }