Esempio n. 1
0
        public void GivenASlashItSuggestsTopLevelOptions()
        {
            var expected = new[] {
                "--diagnostics",
                "--help",
                "--info",
                "--list-runtimes",
                "--list-sdks",
                "--version",
                "-d",
                "-h",
                "build-server" // This should be removed when completion is based on "starts with" rather than "contains".
                               // See https://github.com/dotnet/cli/issues/8958.
            };

            var reporter = new BufferedReporter();

            CompleteCommand.RunWithReporter(new[] { "dotnet -" }, reporter).Should().Be(0);
            reporter.Lines.Should().Equal(expected.OrderBy(c => c));
        }
Esempio n. 2
0
 private async System.Threading.Tasks.Task OnComplete(bool?selected)
 {
     try
     {
         if (selected == true)
         {
             await _service.ChangeTaskStatusAsync(Task, TaskStatus.TaskComplete);
         }
         else if (selected == false)
         {
             await _service.ChangeTaskStatusAsync(Task, TaskStatus.TaskNotStarted);
         }
     }
     catch (TimeoutException timeoutEx)
     {
         _eventAggregator.GetEvent <TimeoutErrorEvent>().Publish(timeoutEx);
     }
     CompleteCommand.RaiseCanExecuteChanged();
     StartCommand.RaiseCanExecuteChanged();
 }
Esempio n. 3
0
        public void GivenNuGetDeleteCommandItDisplaysCompletions()
        {
            var expected = new[] {
                "--api-key",
                "--force-english-output",
                "--help",
                "--no-service-endpoint",
                "--non-interactive",
                "--source",
                "--interactive",
                "-h",
                "-k",
                "-s",
            };

            var reporter = new BufferedReporter();

            CompleteCommand.RunWithReporter(new[] { "dotnet nuget delete " }, reporter).Should().Be(0);
            reporter.Lines.Should().Equal(expected.OrderBy(c => c));
        }
        public async Task Then_the_current_period_MonthEndProcessingCompletedDate_is_set()
        {
            //Arrange
            var command      = new CompleteCommand(_completionDate, new Domain.ValueObjects.CollectionPeriod(_firstCollectionPeriod.CollectionPeriod.PeriodNumber, _firstCollectionPeriod.CalendarYear));
            var savedPeriods = new List <Domain.ValueObjects.CollectionCalendarPeriod>();

            _mockCollectionCalendarService.Setup(m => m.Save(It.IsAny <Domain.ValueObjects.CollectionCalendar>()))
            .Callback <Domain.ValueObjects.CollectionCalendar>(c =>
            {
                savedPeriods.AddRange(c.GetAllPeriods());
            });

            // Act
            await _sut.Handle(command);

            // Assert
            var savedFirstPeriod = savedPeriods.Single(p => p.CollectionPeriod.PeriodNumber == _firstCollectionPeriod.CollectionPeriod.PeriodNumber);

            savedFirstPeriod.MonthEndProcessingCompletedDate.Should().Be(_completionDate);
        }
Esempio n. 5
0
        public void GivenOnlyDotnetItSuggestsTopLevelCommandsAndOptions()
        {
            var expected = new[] {
                "--diagnostics",
                "--help",
                "--info",
                "--list-runtimes",
                "--list-sdks",
                "--version",
                "-?",
                "-d",
                "-h",
                "/?",
                "/h",
                "add",
                "build",
                "build-server",
                "clean",
                "fsi",
                "help",
                "list",
                "msbuild",
                "new",
                "nuget",
                "pack",
                "publish",
                "remove",
                "restore",
                "run",
                "sln",
                "store",
                "test",
                "tool",
                "vstest"
            };

            var reporter = new BufferedReporter();

            CompleteCommand.RunWithReporter(new[] { "dotnet " }, reporter).Should().Be(0);
            reporter.Lines.OrderBy(c => c).Should().Equal(expected.OrderBy(c => c));
        }
Esempio n. 6
0
        public void GivenNuGetCommandItDisplaysCompletions()
        {
            var expected = new[] {
                "--help",
                "--verbosity",
                "--version",
                "-?",
                "-h",
                "-v",
                "/?",
                "/h",
                "delete",
                "locals",
                "push",
            };

            var reporter = new BufferedReporter();

            CompleteCommand.RunWithReporter(new[] { "dotnet nuget " }, reporter).Should().Be(0);
            reporter.Lines.OrderBy(c => c).Should().Equal(expected.OrderBy(c => c));
        }
Esempio n. 7
0
        public void GivenNuGetLocalsCommandItDisplaysCompletions()
        {
            var expected = new string[] {
                "--clear",
                "--force-english-output",
                "--help",
                "--list",
                "-c",
                "-h",
                "-l",
                "all",
                "global-packages",
                "http-cache",
                "temp"
            };

            var reporter = new BufferedReporter();

            CompleteCommand.RunWithReporter(new[] { "dotnet nuget locals " }, reporter).Should().Be(0);
            reporter.Lines.Should().Equal(expected.OrderBy(c => c));
        }
Esempio n. 8
0
    public void SetUp()
    {
        originalOutput = Console.Out;
        output         = new StringWriter();
        Console.SetOut(output);

        commandLocator        = Substitute.For <ICommandLocator>();
        logger                = new LoggerConfiguration().WriteTo.TextWriter(output).CreateLogger();
        commandOutputProvider = new CommandOutputProvider("TestApp", "1.0.0", new DefaultCommandOutputJsonSerializer(), logger);
        commandLocator.List()
        .Returns(new ICommandMetadata[]
        {
            new CommandAttribute("test"),
            new CommandAttribute("help")
        });
        var helpCommand = new HelpCommand(new Lazy <ICommandLocator>(() => commandLocator), commandOutputProvider);
        var testCommand = new TestCommand(commandOutputProvider);

        commandLocator.Find("help").Returns(helpCommand);
        commandLocator.Find("test").Returns(testCommand);
        completeCommand = new CompleteCommand(new Lazy <ICommandLocator>(() => commandLocator), commandOutputProvider);
    }
Esempio n. 9
0
        public string GetHelpCommand(string commandName, string alias = null)
        {
            Command commandToPrint;

            if (Commands.TryGetValue(commandName, out commandToPrint))
            {
                StringBuilder sb = new StringBuilder();
                Dictionary <string, string> commandParametersToPrint = new Dictionary <string, string>();

                sb.AppendLine().Append("Settings: ").AppendLine();
                sb.Append(GetHelpAlias(commandToPrint.Alias[alias].Settings, commandParametersToPrint));

                //sb.AppendLine().Append("Default Settings for action (values can be overwritten): ").AppendLine();
                sb.Append(GetHelpAlias(commandToPrint.DefaultValues.Settings, commandParametersToPrint));

                CompleteCommand completeCommand = BuildCommand(commandName, new List <string>(alias.Split(' ')), commandParametersToPrint);

                sb.AppendLine().Append("It will run: ").AppendLine();
                sb.Append(string.Format("{0} {1}", completeCommand.ToolCommand, completeCommand.ParametersCommand));
                return(sb.ToString());
            }
            return(null);
        }
Esempio n. 10
0
        public int ExecuteCommand(string commandSelectedByUser, List <string> parametersSelectedByUser)
        {
            ParseRunToolSettings(commandSelectedByUser);
            string runQuietValue;
            bool   runQuiet = false;

            if (ToolSettings.TryGetValue(RunQuietReservedKeyword, out runQuietValue))
            {
                runQuiet = runQuietValue.Equals("true", StringComparison.OrdinalIgnoreCase);
            }
            CompleteCommand commandToRun = BuildCommand(commandSelectedByUser, parametersSelectedByUser);

            if (commandToRun != null)
            {
                if (!runQuiet)
                {
                    PrintColorMessage(ConsoleColor.DarkYellow, "Running: {0} {1}", commandToRun.ToolCommand, commandToRun.ParametersCommand);
                }

                int result = RunProcess.ExecuteProcess(commandToRun.ToolCommand, commandToRun.ParametersCommand);
                if (!runQuiet)
                {
                    if (result == 0)
                    {
                        PrintColorMessage(ConsoleColor.Green, "Command execution succeeded.");
                    }
                    else
                    {
                        PrintColorMessage(ConsoleColor.Red, "Command execution failed with exit code {0}.", result);
                    }
                }

                return(result);
            }
            return(1);
        }
Esempio n. 11
0
        public async Task <IActionResult> Complete(string id, string elt, [FromBody] CompleteCommand command, CancellationToken token)
        {
            try
            {
                command.CaseInstanceId        = id;
                command.CaseInstanceElementId = elt;
                await _mediator.Send(command, token);

                return(new OkResult());
            }
            catch (UnknownCasePlanInstanceException)
            {
                return(this.ToError(new Dictionary <string, string>
                {
                    { "bad_request", "case instance doesn't exist" }
                }, HttpStatusCode.NotFound, Request));
            }
            catch (UnknownCasePlanElementInstanceException)
            {
                return(this.ToError(new Dictionary <string, string>
                {
                    { "bad_request", "case instance element doesn't exist" }
                }, HttpStatusCode.NotFound, Request));
            }
            catch (AggregateValidationException ex)
            {
                return(this.ToError(ex.Errors, HttpStatusCode.BadRequest, Request));
            }
            catch (Exception ex)
            {
                return(this.ToError(new Dictionary <string, string>
                {
                    { "invalid_request", ex.Message }
                }, HttpStatusCode.BadRequest, Request));
            }
        }
Esempio n. 12
0
        private CompleteCommand BuildCommand(string commandSelectedByUser, List <string> parametersSelectedByUser, Dictionary <string, string> parameters = null)
        {
            Command commandToExecute;

            if (!Commands.TryGetValue(commandSelectedByUser, out commandToExecute))
            {
                Console.Error.WriteLine("Error: The command {0} is not specified in the Json file.", commandSelectedByUser);
                return(null);
            }

            string commandTool = GetTool(commandToExecute, Os, ConfigurationFilePath, parametersSelectedByUser);

            if (string.IsNullOrEmpty(commandTool))
            {
                return(null);
            }

            if (parameters == null)
            {
                if (BuildRequiredValueSettingsForCommand(commandToExecute, parametersSelectedByUser, SettingParameters) &&
                    BuildDefaultValueSettingsForCommand(commandToExecute, SettingParameters) &&
                    ValidExtraParametersForCommand(ExtraParameters, SettingParameters))
                {
                    string          commandParameters = $"{BuildParametersForCommand(SettingParameters, SettingParameters["toolName"])} {ExtraParameters}";
                    CompleteCommand completeCommand   = new CompleteCommand(commandTool, commandParameters);
                    return(completeCommand);
                }
                return(null);
            }
            else
            {
                string          commandParameters = BuildParametersForCommand(parameters, SettingParameters["toolName"]);
                CompleteCommand completeCommand   = new CompleteCommand(commandTool, commandParameters);
                return(completeCommand);
            }
        }
        public TechnicalInspectionPageViewModel(INavigationService navigationService, IEventAggregator eventAggregator)
            : base(navigationService)
        {
            try
            {
                _navigationService          = navigationService;
                this._eventAggregator       = eventAggregator;
                this.InspectionUserControls = new ObservableCollection <UserControl>();
                this.CustomerDetails        = new CustomerDetails();
                this.MaintenanceRepairList  = new ObservableCollection <MaintenanceRepair>();
                this.Model = new TIData();



                this.CompleteCommand = new DelegateCommand(async() =>
                {
                    try
                    {
                        this.IsBusy = true;
                        AppSettings.Instance.IsSynchronizing = 1;
                        this._task.Status = Pithline.FMS.BusinessLogic.Helpers.TaskStatus.Completed;
                        await SqliteHelper.Storage.UpdateSingleRecordAsync(this._task);
                        var model             = ((TIData)this.Model);
                        model.ShouldSave      = true;
                        model.VehicleInsRecID = _task.CaseServiceRecID;
                        var tiDataTable       = await SqliteHelper.Storage.LoadTableAsync <TIData>();
                        if (tiDataTable.Any(x => x.VehicleInsRecID == model.VehicleInsRecID))
                        {
                            await SqliteHelper.Storage.UpdateSingleRecordAsync <TIData>(model);
                        }
                        else
                        {
                            await SqliteHelper.Storage.InsertSingleRecordAsync <TIData>(model);
                        }
                        TIServiceHelper.Instance.Synchronize();
                        // this.SaveCurrentUIDataAsync(currentModel);
                        _navigationService.Navigate("Main", null);

                        //await TIServiceHelper.Instance.UpdateTaskStatusAsync();
                        this.IsBusy = false;
                        _eventAggregator.GetEvent <TITaskFetchedEvent>().Publish(this._task);
                    }
                    catch (Exception ex)
                    {
                        this.IsBusy = false;
                        AppSettings.Instance.IsSynchronizing = 0;
                        AppSettings.Instance.ErrorMessage    = ex.Message;
                    }
                });

                this._eventAggregator.GetEvent <SignChangedEvent>().Subscribe(p =>
                {
                    CompleteCommand.RaiseCanExecuteChanged();
                });

                this._eventAggregator.GetEvent <ErrorsRaisedEvent>().Subscribe((errors) =>
                {
                    Errors = errors;
                    OnPropertyChanged("Errors");
                    ShowValidationSummary = true;
                    OnPropertyChanged("ShowValidationSummary");
                }, ThreadOption.UIThread);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 14
0
        private CompleteCommand BuildCommand(string commandSelectedByUser, List<string> parametersSelectedByUser, Dictionary<string, string> parameters = null)
        {
            Command commandToExecute;
            if (!Commands.TryGetValue(commandSelectedByUser, out commandToExecute))
            {
                Console.Error.WriteLine("Error: The command {0} is not specified in the Json file.", commandSelectedByUser);
                return null;
            }

            string commandTool = GetTool(commandToExecute, Os, ConfigurationFilePath, parametersSelectedByUser);
            if (string.IsNullOrEmpty(commandTool))
            {
                return null;
            }

            if (parameters == null)
            {
                if (BuildRequiredValueSettingsForCommand(commandToExecute, parametersSelectedByUser, SettingParameters) &&
                    BuildDefaultValueSettingsForCommand(commandToExecute, SettingParameters) &&
                    ValidExtraParametersForCommand(SettingParameters["ExtraParameters"], SettingParameters))
                {
                    string commandParameters = BuildParametersForCommand(SettingParameters, SettingParameters["toolName"]);
                    CompleteCommand completeCommand = new CompleteCommand(commandTool, commandParameters);
                    return completeCommand;
                }
                return null;
            }
            else
            {
                string commandParameters = BuildParametersForCommand(parameters, SettingParameters["toolName"]);
                CompleteCommand completeCommand = new CompleteCommand(commandTool, commandParameters);
                return completeCommand;
            }
        }
            public Task PublishExternalEvt(string evt, string casePlanInstanceId, string casePlanElementInstanceId, Dictionary <string, string> parameters, CancellationToken token)
            {
                IBaseRequest request = null;

                switch (evt)
                {
                case CMMNConstants.ExternalTransitionNames.AddChild:
                    request = new AddChildCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Close:
                    request = new CloseCommand(casePlanInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Complete:
                    request = new CompleteCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Disable:
                    request = new DisableCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Occur:
                    request = new OccurCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Reactivate:
                    request = new ReactivateCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Reenable:
                    request = new ReenableCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Resume:
                    request = new ResumeCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Suspend:
                    request = new SuspendCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Terminate:
                    request = new TerminateCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.ManualStart:
                    request = new ActivateCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;
                }

                return(_mediator.Send(request, token));
            }
Esempio n. 16
0
        public VehicleInspectionPageViewModel(INavigationService navigationService, IEventAggregator eventAggregator)
            : base(navigationService)
        {
            try
            {
                _navigationService          = navigationService;
                this._eventAggregator       = eventAggregator;
                this.InspectionUserControls = new ObservableCollection <UserControl>();
                this.CustomerDetails        = new CustomerDetails();

                this.PrevViewStack = new Stack <UserControl>();
                // LoadDemoAppointments();

                this.CompleteCommand = new DelegateCommand(async() =>
                {
                    this.IsBusy            = true;
                    this._task.ProcessStep = ProcessStep.AcceptInspection;
                    this._task.ShouldSync  = true;
                    this._task.Status      = Pithline.FMS.BusinessLogic.Helpers.TaskStatus.AwaitDamageConfirmation;
                    await SqliteHelper.Storage.UpdateSingleRecordAsync(this._task);
                    var currentViewModel = ((BaseViewModel)this.NextViewStack.Peek().DataContext);
                    var currentModel     = currentViewModel.Model;

                    if (currentViewModel is TTyreConditionUserControlViewModel)
                    {
                        await((TTyreConditionUserControlViewModel)currentViewModel).SaveTrailerTyreConditions(this._task.VehicleInsRecId);
                    }
                    else
                    {
                        this.SaveCurrentUIDataAsync(currentModel);
                    }
                    _navigationService.Navigate("Main", null);

                    await VIServiceHelper.Instance.UpdateTaskStatusAsync();
                    this.IsBusy = false;
                }, () =>
                {
                    var vm = ((BaseViewModel)this.NextViewStack.Peek().DataContext);
                    if (vm is InspectionProofUserControlViewModel)
                    {
                        return((this.NextViewStack.Count == 1) && (((InspectionProofUserControlViewModel)vm).CustSignature != null) && (((InspectionProofUserControlViewModel)vm).PithlineRepSignature != null));
                    }
                    else if (vm is CPOIUserControlViewModel)
                    {
                        return((this.NextViewStack.Count == 1) && (((CPOIUserControlViewModel)vm).CustSignature != null) && (((CPOIUserControlViewModel)vm).PithlineRepSignature != null));
                    }
                    else
                    {
                        return(this.NextViewStack.Count == 1);
                    }
                });

                this._eventAggregator.GetEvent <SignChangedEvent>().Subscribe(p =>
                {
                    CompleteCommand.RaiseCanExecuteChanged();
                });

                this._eventAggregator.GetEvent <ErrorsRaisedEvent>().Subscribe((errors) =>
                {
                    Errors = errors;
                    OnPropertyChanged("Errors");
                    ShowValidationSummary = true;
                    OnPropertyChanged("ShowValidationSummary");
                }, ThreadOption.UIThread);

                this.NextCommand = new DelegateCommand(async() =>
                {
                    //this.IsCommandBarOpen = false;
                    //this.IsFlyoutOpen = true;
                    ShowValidationSummary = false;
                    var currentViewModel  = (BaseViewModel)this.NextViewStack.Peek().DataContext;
                    var currentModel      = currentViewModel.Model as BaseModel;

                    if (currentModel.ValidateModel() && await currentModel.VehicleDetailsImagesValidate())
                    {
                        this.PrevViewStack.Push(this.NextViewStack.Pop());
                        if (currentViewModel is TTyreConditionUserControlViewModel)
                        {
                            await((TTyreConditionUserControlViewModel)currentViewModel).SaveTrailerTyreConditions(this._task.VehicleInsRecId);
                        }
                        else
                        {
                            this.SaveCurrentUIDataAsync(currentModel);
                        }

                        this.FrameContent = this.NextViewStack.Peek();
                        CompleteCommand.RaiseCanExecuteChanged();
                        NextCommand.RaiseCanExecuteChanged();
                        PreviousCommand.RaiseCanExecuteChanged();
                        if (this.NextViewStack.FirstOrDefault() != null)
                        {
                            BaseViewModel nextViewModel = this.NextViewStack.FirstOrDefault().DataContext as BaseViewModel;
                            await nextViewModel.LoadModelFromDbAsync(this._task.VehicleInsRecId);
                        }
                    }
                    else
                    {
                        Errors = currentModel.Errors;
                        OnPropertyChanged("Errors");
                        ShowValidationSummary = true;
                    }
                }, () =>
                {
                    return(this.NextViewStack.Count > 1);
                });


                this.PreviousCommand = new DelegateCommand(async() =>
                {
                    this.IsCommandBarOpen = false;
                    ShowValidationSummary = false;
                    var currentViewModel  = ((BaseViewModel)this.NextViewStack.Peek().DataContext);
                    var currentModel      = currentViewModel.Model as BaseModel;

                    if (currentModel is PInspectionProof)
                    {
                        ((InspectionProofUserControlViewModel)this.NextViewStack.Peek().DataContext).CustSignature        = null;
                        ((InspectionProofUserControlViewModel)this.NextViewStack.Peek().DataContext).PithlineRepSignature = null;
                        SetFrameContent();
                    }
                    else if (currentModel is CPOI)
                    {
                        ((CPOIUserControlViewModel)this.NextViewStack.Peek().DataContext).CustSignature        = null;
                        ((CPOIUserControlViewModel)this.NextViewStack.Peek().DataContext).PithlineRepSignature = null;
                        SetFrameContent();
                    }

                    else
                    {
                        if (currentModel.ValidateModel())
                        {
                            SetFrameContent();


                            if (currentViewModel is TTyreConditionUserControlViewModel)
                            {
                                await((TTyreConditionUserControlViewModel)currentViewModel).SaveTrailerTyreConditions(this._task.VehicleInsRecId);
                            }
                            else
                            {
                                this.SaveCurrentUIDataAsync(currentModel);
                            }

                            if (this.PrevViewStack.FirstOrDefault() != null)
                            {
                                BaseViewModel nextViewModel = this.PrevViewStack.FirstOrDefault().DataContext as BaseViewModel;
                                await nextViewModel.LoadModelFromDbAsync(this._task.VehicleInsRecId);
                            }
                        }
                        else
                        {
                            Errors = currentModel.Errors;
                            OnPropertyChanged("Errors");
                            ShowValidationSummary = true;
                        }
                    }
                }, () =>
                {
                    return(this.PrevViewStack.Count > 0);
                });
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 17
0
        private void PerformCommand(string commandName, string parameter = null, DeveroomEditorCommandTargetKey?commandTargetKey = null)
        {
            ActionsMock.ResetMock();
            switch (commandName)
            {
            case "Go To Definition":
            {
                var command = new GoToStepDefinitionCommand(_ideScope,
                                                            new StubBufferTagAggregatorFactoryService(_ideScope), _ideScope.MonitoringService);
                command.PreExec(_wpfTextView, command.Targets.First());
                break;
            }

            case "Find Step Definition Usages":
            {
                var command = new FindStepDefinitionCommand(_ideScope,
                                                            new StubBufferTagAggregatorFactoryService(_ideScope), _ideScope.MonitoringService);
                command.PreExec(_wpfTextView, command.Targets.First());
                Wait.For(() => ActionsMock.IsComplete.Should().BeTrue());
                break;
            }

            case "Comment":
            {
                var command = new CommentCommand(_ideScope,
                                                 new StubBufferTagAggregatorFactoryService(_ideScope), _ideScope.MonitoringService);
                command.PreExec(_wpfTextView, command.Targets.First());
                break;
            }

            case "Uncomment":
            {
                var command = new UncommentCommand(_ideScope,
                                                   new StubBufferTagAggregatorFactoryService(_ideScope), _ideScope.MonitoringService);
                command.PreExec(_wpfTextView, command.Targets.First());
                break;
            }

            case "Auto Format Table":
            {
                var command = new AutoFormatTableCommand(_ideScope,
                                                         new StubBufferTagAggregatorFactoryService(_ideScope), _ideScope.MonitoringService);
                _wpfTextView.SimulateType(command, parameter?[0] ?? '|');
                break;
            }

            case "Define Steps":
            {
                var command = new DefineStepsCommand(_ideScope,
                                                     new StubBufferTagAggregatorFactoryService(_ideScope), _ideScope.MonitoringService);
                command.PreExec(_wpfTextView, command.Targets.First());
                break;
            }

            case "Complete":
            case "Filter Completion":
            {
                EnsureStubCompletionBroker();
                var command = new CompleteCommand(_ideScope,
                                                  new StubBufferTagAggregatorFactoryService(_ideScope),
                                                  _completionBroker, _ideScope.MonitoringService);
                if (parameter == null)
                {
                    command.PreExec(_wpfTextView, commandTargetKey ?? command.Targets.First());
                }
                else
                {
                    _wpfTextView.SimulateTypeText(command, parameter);
                }
                break;
            }

            default:
                throw new NotImplementedException(commandName);
            }
        }