Beispiel #1
0
        public void Can_comment_out_lines(string test, int selectionStartLine, int selectionStartColumn, int?selectionEndLine, int?selectionEndColumn, string expectedTextValue)
        {
            Console.WriteLine($"running: {test}");
            var command   = new CommentCommand(null, null, _monitoringService);
            var inputText = new TestText(
                "Feature: foo",
                "Scenario: bar",
                "");
            var textView = CreateTextView(inputText, selectionStartLine, selectionStartColumn, selectionEndLine, selectionEndColumn);

            command.PreExec(textView, command.Targets.First());

            var expectedText = new TestText(expectedTextValue);

            Assert.Equal(expectedText.ToString(), textView.TextSnapshot.GetText());

            AssertLinesSelected(textView, expectedText, selectionStartLine, selectionEndLine);
        }
Beispiel #2
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);
            }
        }