public void AddPreRunScript(ref SqlSyncBuildData data, bool multipleRun) { SqlSyncBuildData.ScriptRow row = data.Script.NewScriptRow(); row.AllowMultipleRuns = multipleRun; row.BuildOrder = 1; row.CausesBuildFailure = true; row.Database = testDatabaseNames[0]; row.DateAdded = testTimeStamp; string fileName = this.GetTrulyUniqueFile(); row.FileName = fileName; row.RollBackOnError = true; row.StripTransactionText = true; row.Description = "Test Script to be skipped"; row.AddedBy = "UnitTest"; row.ScriptId = PreRunScriptGuid; row.SetParentRow(data.Scripts[0]); data.Script.AddScriptRow(row); data.Script.AcceptChanges(); string script = "INSERT INTO TransactionTest (Message, Guid, DateTimeStamp) VALUES ('INSERT TEST','" + testGuid + "','" + testTimeStamp.ToString() + "')"; File.WriteAllText(fileName, script); InsertPreRunScriptEntry(); }
public void AddFailureScript(ref SqlSyncBuildData data, bool rollBackOnError, bool causeBuildFailure) { SqlSyncBuildData.ScriptRow row = data.Script.NewScriptRow(); row.AllowMultipleRuns = true; row.BuildOrder = 10; row.CausesBuildFailure = causeBuildFailure; row.Database = testDatabaseNames[0]; row.DateAdded = testTimeStamp; string fileName = this.GetTrulyUniqueFile(); row.FileName = fileName; row.RollBackOnError = rollBackOnError; row.StripTransactionText = true; row.Description = "Test Script to cause a failure when inserting into TransactionTest table"; row.AddedBy = "UnitTest"; row.ScriptId = Guid.NewGuid().ToString(); row.SetParentRow(data.Scripts[0]); data.Script.AddScriptRow(row); data.Script.AcceptChanges(); string script = "INSERT INTO TransactionTest (INVALID, Guid, DateTimeStamp) VALUES ('INSERT TEST','" + testGuid + "','" + testTimeStamp.ToString() + "')"; File.WriteAllText(fileName, script); }
public void AddScriptWithBadDatabase(ref SqlSyncBuildData data) { SqlSyncBuildData.ScriptRow row = data.Script.NewScriptRow(); row.AllowMultipleRuns = true; row.BuildOrder = 1; row.CausesBuildFailure = true; row.Database = "REALLY_BAD_DATABASE"; row.DateAdded = testTimeStamp; string fileName = this.GetTrulyUniqueFile(); row.FileName = fileName; row.RollBackOnError = true; row.StripTransactionText = true; row.Description = "Test Script that has an invalid database name"; row.AddedBy = "UnitTest"; row.ScriptId = Guid.NewGuid().ToString(); row.SetParentRow(data.Scripts[0]); data.Script.AddScriptRow(row); data.Script.AcceptChanges(); string script = "INSERT INTO TransactionTest (Message, Guid, DateTimeStamp) VALUES ('INSERT TEST','" + testGuid + "','" + testTimeStamp.ToString() + "')"; File.WriteAllText(fileName, script); }
public void AddSelectScript(ref SqlSyncBuildData data) { SqlSyncBuildData.ScriptRow row = data.Script.NewScriptRow(); row.AllowMultipleRuns = true; row.BuildOrder = 1; row.CausesBuildFailure = true; row.Database = testDatabaseNames[0]; row.DateAdded = testTimeStamp; string fileName = this.GetTrulyUniqueFile(); row.FileName = fileName; row.RollBackOnError = true; row.StripTransactionText = true; row.Description = "Test Script to successfully select from TransactionTest table"; row.AddedBy = "UnitTest"; row.ScriptId = Guid.NewGuid().ToString(); row.SetParentRow(data.Scripts[0]); data.Script.AddScriptRow(row); data.Script.AcceptChanges(); string script = "SELECT * FROM TransactionTest"; File.WriteAllText(fileName, script); }
public void AddScriptForProcessBuild(ref SqlSyncBuildData data, bool multipleRun, int scriptTimeout) { SqlSyncBuildData.ScriptRow row = data.Script.NewScriptRow(); row.AllowMultipleRuns = multipleRun; row.BuildOrder = 1; row.CausesBuildFailure = true; row.Database = testDatabaseNames[0]; row.DateAdded = testTimeStamp; row.ScriptTimeOut = scriptTimeout; string fileName = this.GetTrulyUniqueFile(); row.FileName = fileName; row.RollBackOnError = true; row.StripTransactionText = true; row.Description = "Test Script to successfully insert into TransactionTest table"; row.AddedBy = "UnitTest"; row.ScriptId = "59F8CBCA-3FE5-4142-ACB0-3D1D2C25184D"; //Must match GUID from GetScriptBatchCollectionForProcessBuild() row.SetParentRow(data.Scripts[0]); data.Script.AddScriptRow(row); data.Script.AcceptChanges(); string script = "INSERT INTO TransactionTest (Message, Guid, DateTimeStamp) VALUES ('INSERT TEST','" + testGuid + "','" + testTimeStamp.ToString() + "')"; File.WriteAllText(fileName, script); }