Exemple #1
0
        private static void AssertBasicSqlPadBehavior()
        {
            const string statementText =
                @"SELECT
	:BIND_VARIABLE, UNDEFINED, DUMMY AMBIGUOUS,
	SQLPAD_FUNCTION('Invalid parameter 1', 'Invalid parameter 2')
FROM DUAL, DUAL D;
SELECT *;

SELECT 1 FROM DUAL UNION ALL SELECT 2 FROM DUAL UNION ALL SELECT 3, 4 FROM DUAL;

SELECT T.*, :BIND_VARIABLE, :BIND_VARIABLE FROM T@HQ_PDB;

SELECT
	CAST(NULL AS NUMBER(39)),
	CAST(NULL AS NUMBER(0)),
	CAST(NULL AS NUMBER(38, -85)),
	CAST(NULL AS NUMBER(38, 128)),
	CAST(NULL AS RAW(2001)),
	CAST(NULL AS RAW(0)),
	CAST(NULL AS VARCHAR2(32768)),
	CAST(NULL AS NVARCHAR2(2001)),
	CAST(NULL AS FLOAT(127)),
	CAST(NULL AS TIMESTAMP(10)),
	CAST(NULL AS INTERVAL YEAR(10) TO MONTH),
	CAST(NULL AS INTERVAL DAY(10) TO SECOND(10)),
	CAST(NULL AS UROWID(4001)),
	CAST(NULL AS CHAR(2001)),
	CAST(NULL AS NCHAR(1001))
FROM
	DUAL;

SELECT
	CUME_DIST(1, 1) WITHIN GROUP (ORDER BY NULL),
	RANK(1) WITHIN GROUP (ORDER BY NULL),
	DENSE_RANK(1) WITHIN GROUP (ORDER BY NULL),
	PERCENTILE_CONT(0) WITHIN GROUP (ORDER BY NULL),
	PERCENTILE_DISC(0) WITHIN GROUP (ORDER BY NULL),
	COALESCE(NULL, NULL, 0),
	SYSTIMESTAMP(9),
	SYSTIMESTAMP,
	LOCALTIMESTAMP(9),
	LOCALTIMESTAMP,
	CURRENT_TIMESTAMP(9),
	CURRENT_TIMESTAMP,
	CASE WHEN LNNVL(1 <> 1) THEN 1 END,
	EXTRACT(DAY FROM SYSDATE)
FROM
	TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'ALLSTATS LAST ADVANCED')) T1, TABLE(SYS.ODCIRAWLIST(HEXTORAW('ABCDEF'), HEXTORAW('A12345'), HEXTORAW('F98765'))) T2
WHERE
	LNNVL(1 <> 1);"    ;

            Editor.Document.Insert(0, statementText);
            Editor.CaretOffset = 50;

            VisualTestRunner.Wait(0.1);

            Editor.CaretOffset = 111;

            GenericCommands.FindUsages.Execute(null, Editor.TextArea);
            GenericCommands.ExecuteDatabaseCommandWithActualExecutionPlan.Execute(null, Editor.TextArea);
            GenericCommands.ListContextActions.Execute(null, Editor.TextArea);
            GenericCommands.ListCodeGenerationItems.Execute(null, Editor.TextArea);

            VisualTestRunner.Wait(0.2);

            DocumentPage.BindVariables.Count.ShouldBe(1);
            DocumentPage.Schemas.Count.ShouldBeGreaterThan(0);
            DocumentPage.IsDirty.ShouldBe(true);
            DocumentPage.DatabaseModel.ShouldNotBe(null);
            DocumentPage.ConnectionStatus.ShouldBe(ConnectionStatus.Connected);
            DocumentPage.CurrentConnection.ShouldNotBe(null);
            DocumentPage.ConnectionErrorMessage.ShouldBe(String.Empty);
            //DocumentPage.CurrentSchema.Length.ShouldBeGreaterThan(0);

            DocumentPage.OutputViewers.Count.ShouldBe(1);
            var outputViewer = DocumentPage.OutputViewers[0];

            outputViewer.DatabaseOutput.ShouldBe($"Test database output{Environment.NewLine}");
            outputViewer.CompilationErrors.Count.ShouldBe(1);
            outputViewer.ExecutionLog.Length.ShouldBe(65);
            outputViewer.ExecutionLog.ShouldContain("Command executed successfully. (");
            outputViewer.IsBusy.ShouldBe(false);
            outputViewer.HasActiveTransaction.ShouldBe(true);
            outputViewer.TransactionIdentifier.ShouldBe("1.2.3456 (read committed)");
            outputViewer.SessionExecutionStatistics.Count.ShouldBeGreaterThan(0);
            outputViewer.ActiveResultViewer.ShouldNotBe(null);

            outputViewer.ActiveResultViewer.ResultGrid.SelectAllCells();

            outputViewer.SetValue(OutputViewer.HasActiveTransactionProperty, false);

            outputViewer.DataOutputType = DataOutputType.File;
            outputViewer.TabControlResult.SelectedContent.ShouldBe(outputViewer.FileResultViewer);

            var statusInfo = outputViewer.StatusInfo;

            statusInfo.ResultGridAvailable.ShouldBe(true);

            TestPairCharacterInsertion();

            TestPairCharacterInsertionWhenNextCharacterIsThePairCharacter();

            TestPairCharacterInsertionAfterAlreadyEnteredPair();

            TestPairCharacterInsertionBeforeExistingText();

            TestParenthesisCharacterInsertionWithinExistingParenthesis();

            TestPairCharacterDeletionWithCursorBetweenEmptyPair();

            VisualTestRunner.Wait(0.2);
        }
Exemple #2
0
 public void RealApplicationTest()
 {
     VisualTestRunner.RunTest(typeof(VisualComponentTest).AssemblyQualifiedName, nameof(TestBasicSqlPadBehavior));
 }