protected override void ProcessRecord() { if (string.IsNullOrEmpty(Language)) Language = "CSharp"; if (string.IsNullOrEmpty(Provider)) Provider = "SqlServer"; try { var newUserAndLogin = new NewUserAndLogin(new TaskLogger(this), Provider, UserName, Password); if (!string.IsNullOrEmpty(this.Directory)) { ScriptEngine engine = new ScriptEngine(this.Language, null); newUserAndLogin.Execute(engine.Compile(this.Directory)); } if (null != this.MigrationsAssemblyPath) { Assembly asm = Assembly.LoadFrom(this.MigrationsAssemblyPath); newUserAndLogin.Execute(asm); } } catch (Exception e) { ThrowTerminatingError( new ErrorRecord( e, "New-DatabaseUserAndLogin", ErrorCategory.NotSpecified, this ) ); } }
public void TearDown() { DatabaseMigrator.CleanUp(); MigrationsAssembly = null; Logger = null; DatabaseMigrator = null; NewUserAndLogin = null; }
public void NewDatabaseUserAndLogin_Execute_CreatesUserAndLogin() { NewUserAndLogin = new NewUserAndLogin(Logger, "SqlServer", @"Id-TestUser", "Password"); NewUserAndLogin.Execute(MigrationsAssembly); Assert.That(Log.ToString(), Is.Not.Empty); Trace.WriteLine(Log.ToString()); Console.WriteLine(Log.ToString()); }