public void TearDown()
 {
     DatabaseMigrator.CleanUp();
     MigrationsAssembly = null;
     Logger = null;
     DatabaseMigrator = null;
 }
        protected override void ProcessRecord()
        {
            if (string.IsNullOrEmpty(Language))
                Language = "CSharp";

            if (string.IsNullOrEmpty(Provider))
                Provider = "SqlServer";

            try
            {
                DatabaseMigrator db = new DatabaseMigrator(new TaskLogger(this), DryRun, Provider, VersionTo, Trace);

                if (!string.IsNullOrEmpty(this.Directory))
                {
                    ScriptEngine engine = new ScriptEngine(this.Language, null);
                    db.Execute(engine.Compile(this.Directory));
                }
                if (null != this.MigrationsAssemblyPath)
                {
                    Assembly asm = Assembly.LoadFrom(this.MigrationsAssemblyPath);
                    db.Execute(asm);
                }
            }
            catch (Exception e)
            {
                ThrowTerminatingError(
                    new ErrorRecord(
                        e,
                        "Push-DatabaseMigrations",
                        ErrorCategory.NotSpecified,
                        this
                        )
                    );
            }
        }
 public void SetUp()
 {
     string folder = Path.GetDirectoryName(Assembly.GetAssembly(typeof(DatabaseMigratorTests)).CodeBase);
     MigrationsAssembly = Assembly.LoadFrom(new Uri(Path.Combine(folder,
                                  "ExampleMigrationAssemblies\\Id.VisaDebitMicrositeAU.DatabaseMigrations.dll")).LocalPath);
     Log = new StringBuilder();
     Logger = new StringLogger(Log);
     DatabaseMigrator = new DatabaseMigrator(Logger, true, "SqlServer", -1, true) {TestMode = true};
 }