Пример #1
0
        public void RemoveCharacterToObjectIdentifierUsingDelete()
        {
            _editor.Text        = "SELECT DU_AL.DUMMY C1, DU_AL.DUMMY C2 FROM DUAL DU_AL";
            _editor.CaretOffset = 9;

            var executionContext = ActionExecutionContext.Create(_editor, ConfigureDocumentRepository());

            MultiNodeEditor.TryCreateMultiNodeEditor(_editor, executionContext, _infrastructureFactory.CreateMultiNodeEditorDataProvider(), out MultiNodeEditor multiNodeEditor).ShouldBe(true);

            multiNodeEditor.RemoveCharacter(false).ShouldBe(true);

            _editor.Text.ShouldBe("SELECT DU_AL.DUMMY C1, DUAL.DUMMY C2 FROM DUAL DUAL");
        }
Пример #2
0
        public void ReplaceTextWhenRenamingChildColumnIdentifierWithSameColumnWithMultipleAliases()
        {
            _editor.Text        = "SELECT ALIAS2 ALIAS3 FROM (SELECT ALIAS1 ALIAS2 FROM (SELECT DUMMY ALIAS1 FROM DUAL))";
            _editor.CaretOffset = 35;

            var executionContext = ActionExecutionContext.Create(_editor, ConfigureDocumentRepository());

            MultiNodeEditor.TryCreateMultiNodeEditor(_editor, executionContext, _infrastructureFactory.CreateMultiNodeEditorDataProvider(), out MultiNodeEditor multiNodeEditor).ShouldBe(true);

            multiNodeEditor.Replace("__").ShouldBe(true);

            _editor.Text.ShouldBe("SELECT ALIAS2 ALIAS3 FROM (SELECT ALIAS1 ALIAS2 FROM (SELECT DUMMY A__LIAS1 FROM DUAL))");
        }
Пример #3
0
        public void AddTextToObjectIdentifier()
        {
            _editor.Text        = "SELECT DUAL.DUMMY C1, DUAL.DUMMY C2 FROM DUAL DUAL";
            _editor.CaretOffset = 9;

            var executionContext = ActionExecutionContext.Create(_editor, ConfigureDocumentRepository());

            MultiNodeEditor.TryCreateMultiNodeEditor(_editor, executionContext, _infrastructureFactory.CreateMultiNodeEditorDataProvider(), out MultiNodeEditor multiNodeEditor).ShouldBeTrue();

            multiNodeEditor.Replace("__").ShouldBeTrue();

            _editor.Text.ShouldBe("SELECT DUAL.DUMMY C1, DU__AL.DUMMY C2 FROM DUAL DU__AL");
        }
Пример #4
0
        public void ReplaceTextWhenRenamingObjectIdentifier()
        {
            _editor.Text        = "SELECT DU__AL.DUMMY C1, DU__AL.DUMMY C2 FROM DUAL DU__AL";
            _editor.CaretOffset = 9;

            var executionContext = ActionExecutionContext.Create(_editor, ConfigureDocumentRepository());

            MultiNodeEditor.TryCreateMultiNodeEditor(_editor, executionContext, _infrastructureFactory.CreateMultiNodeEditorDataProvider(), out MultiNodeEditor multiNodeEditor).ShouldBe(true);

            _editor.SelectionLength = 2;
            _editor.CaretOffset     = 9;
            multiNodeEditor.Replace("xx").ShouldBe(true);

            _editor.Text.ShouldBe("SELECT DU__AL.DUMMY C1, DUxxAL.DUMMY C2 FROM DUAL DUxxAL");
        }
Пример #5
0
        public void CancelEditing()
        {
            const string originalText = "SELECT DUAL.DUMMY C1, DUAL.DUMMY C2 FROM DUAL DUAL";

            _editor.Text = originalText;

            const int originalCaretOffset = 9;

            _editor.CaretOffset = 9;

            var executionContext = ActionExecutionContext.Create(_editor, ConfigureDocumentRepository());

            MultiNodeEditor.TryCreateMultiNodeEditor(_editor, executionContext, _infrastructureFactory.CreateMultiNodeEditorDataProvider(), out MultiNodeEditor multiNodeEditor).ShouldBe(true);

            _editor.Document.Insert(_editor.CaretOffset, "__");

            multiNodeEditor.Replace("__").ShouldBe(true);
            multiNodeEditor.Cancel();

            _editor.Text.ShouldBe(originalText);
            _editor.CaretOffset.ShouldBe(originalCaretOffset);
        }