public RunGroupOrderScenarios()
        {
            upgradeResult = null;
            scripts       = new List <SqlScript>
            {
                new SqlScript("ZZZScript1.sql", "create table Foo (Id int identity)", new SqlScriptOptions {
                    ScriptType = ScriptType.RunOnce, RunGroupOrder = DbUpDefaults.DefaultRunGroupOrder
                }),
                new SqlScript("ZZZScript2.sql", "alter table Foo add column Name varchar(255)", new SqlScriptOptions {
                    ScriptType = ScriptType.RunOnce, RunGroupOrder = DbUpDefaults.DefaultRunGroupOrder
                }),
                new SqlScript("AAAScript3.sql", "insert into Foo (Name) values ('test')", new SqlScriptOptions {
                    ScriptType = ScriptType.RunOnce, RunGroupOrder = DbUpDefaults.DefaultRunGroupOrder + 1
                })
            };

            logger = new CaptureLogsLogger();
            recordingConnection   = new RecordingDbConnection(logger, "SchemaVersions");
            testConnectionFactory = new DelegateConnectionFactory(_ => recordingConnection);

            upgradeEngineBuilder = DeployChanges.To
                                   .SqlDatabase("testconn")
                                   .WithScripts(new TestScriptProvider(scripts))
                                   .OverrideConnectionFactory(testConnectionFactory)
                                   .LogTo(logger);
        }
        public TransactionScenarios()
        {
            logger = new CaptureLogsLogger();

            // Automatically approve the change, make sure to check the result before committing
            // assentConfig = assentConfig.UsingReporter((received, approved) => File.Copy(received, approved, true));
        }
        Action Deploy(Func <SupportedDatabases, UpgradeEngineBuilder> deployTo, Func <UpgradeEngineBuilder, string, string, UpgradeEngineBuilder> addCustomNamedJournal)
        {
            return(() =>
            {
                scripts = new List <SqlScript>();
                logger = new CaptureLogsLogger();
                recordingConnection = new RecordingDbConnection(logger, "SchemaVersions");
                testConnectionFactory = new DelegateConnectionFactory(_ => recordingConnection);
                upgradeEngineBuilder = deployTo(DeployChanges.To)
                                       .WithScripts(scripts)
                                       .OverrideConnectionFactory(testConnectionFactory)
                                       .LogTo(logger);

                addCustomNamedJournalToBuilder = addCustomNamedJournal;
            });
        }