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