public void ParseQuery_DoubleSelectQueryFromClauseMixedLine_TableFullNameTest() { List <SelectStatement> selectStatements = SqlStatementParser.ParseSelectStatement(DoubleSelectQueryFromClauseMixedLine); Assert.IsTrue(selectStatements[0].PrimaryTableName.FullName == DoubleSelectQueryFromClauseMixedLine_PrimaryTableFullName1); Assert.IsTrue(selectStatements[1].PrimaryTableName.FullName == DoubleSelectQueryFromClauseMixedLine_PrimaryTableFullName2); }
public void ParseQuery_DoubleSelectQueryFromClauseMixedLine_SelectTextTest() { List <SelectStatement> selectStatements = SqlStatementParser.ParseSelectStatement(DoubleSelectQueryFromClauseMixedLine); Assert.IsTrue(selectStatements[0].SelectText == DoubleSelectQueryFromClauseMixedLine_SelectText1); Assert.IsTrue(selectStatements[1].SelectText == DoubleSelectQueryFromClauseMixedLine_SelectText2); }
private MergeScriptParseCollection CreateDataTableFromScript(string dataScriptKey, DataScriptCollection dataScriptCollection, Dictionary <string, string> databaseTableInfo) { string databaseTableScriptContents = File.ReadAllText(databaseTableInfo[dataScriptKey]); DataTable dataTable = SqlStatementParser.ParseTableCreate(databaseTableScriptContents); Dictionary <DatabaseEnvironment, DataScript> dataScripts = dataScriptCollection.GetDataScriptByName(dataScriptKey); Dictionary <DatabaseEnvironment, MergeScriptParseResult> mergeScriptParseResults = new Dictionary <DatabaseEnvironment, MergeScriptParseResult>(dataScripts.Count); bool containsErrors = false; foreach (DataScript dataScript in dataScripts.Values) { string dataScriptContents = File.ReadAllText(dataScript.Path); MergeScriptParseResult mergeScriptParseResult; try { mergeScriptParseResult = SqlStatementParser.ParseMergeScript(dataScriptContents, dataTable); } catch (Exception ex) { containsErrors = true; mergeScriptParseResult = new MergeScriptParseResult(dataTable, false, false, new List <string> { $"Path: {dataScript.Path}\r\nException: {ex.Message}\r\nStack: {ex.StackTrace}" }); } mergeScriptParseResults.Add(dataScript.Environment, mergeScriptParseResult); } return(new MergeScriptParseCollection(mergeScriptParseResults, containsErrors)); }
public void ParseQuery_DoubleSelectQueryFromClauseMixedLine_FromTextTest() { List <SelectStatement> selectStatements = SqlStatementParser.ParseSelectStatement(DoubleSelectQueryFromClauseMixedLine); Assert.IsTrue( selectStatements[0].FromText == DoubleSelectQueryFromClauseMixedLine_FromText1, $"From text does not match first select statement. Actual value: {selectStatements[0].FromText}"); Assert.IsTrue(selectStatements[1].FromText == DoubleSelectQueryFromClauseMixedLine_FromText2, $"From text does not match second select statement. Actual value: {selectStatements[1].FromText}"); }
public void ParseQuery_SingleSelectQueryFromClauseSingleLine_TableFullNameTest() { List <SelectStatement> selectStatements = SqlStatementParser.ParseSelectStatement(SingleSelectQueryFromClauseSingleLine); Assert.IsTrue(selectStatements[0].PrimaryTableName.FullName == SingleSelectQueryFromClauseSingleLine_PrimaryTableFullName); }
public void ParseQuery_SingleSelectQueryFromClauseSingleLine_FromTextTest() { List <SelectStatement> selectStatements = SqlStatementParser.ParseSelectStatement(SingleSelectQueryFromClauseSingleLine); Assert.IsTrue(selectStatements[0].FromText == SingleSelectQueryFromClauseSingleLine_FromText); }
public void ParseQuery_SingleSelectQueryFromClauseSingleLine_ErrorMessageTest() { List <SelectStatement> selectStatements = SqlStatementParser.ParseSelectStatement(SingleSelectQueryFromClauseSingleLine); Assert.IsTrue(selectStatements[0].ErrorMessages.Count == 0); }
public void ParseQuery_SingleSelectQueryFromClauseSingleLine_StatementCountTest() { List <SelectStatement> selectStatements = SqlStatementParser.ParseSelectStatement(SingleSelectQueryFromClauseSingleLine); Assert.IsTrue(selectStatements.Count == 1); }
public void ParseQuery_DoubleSelectQueryFromClauseMixedLine_StatementCountTest() { List <SelectStatement> selectStatements = SqlStatementParser.ParseSelectStatement(DoubleSelectQueryFromClauseMixedLine); Assert.IsTrue(selectStatements.Count == 2); }