コード例 #1
0
 public void TearDown()
 {
     DatabaseMigrator.CleanUp();
     MigrationsAssembly = null;
     Logger             = null;
     DatabaseMigrator   = null;
     NewUserAndLogin    = null;
 }
コード例 #2
0
        public void NewDatabaseUserAndLogin_Execute_CreatesUserAndLogin()
        {
            NewUserAndLogin = new NewUserAndLogin(Logger, @"Id-TestUser", "Password");
            NewUserAndLogin.Execute(Settings);

            Assert.That(Log.ToString(), Is.Not.Empty);
            Trace.WriteLine(Log.ToString());
            Console.WriteLine(Log.ToString());
        }
コード例 #3
0
        protected override void ProcessRecord()
        {
            if (string.IsNullOrEmpty(Language))
            {
                Language = "CSharp";
            }

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

            try
            {
                var newUserAndLogin = new NewUserAndLogin(new TaskLogger(this), UserName, Password);

                if (!string.IsNullOrEmpty(this.Directory))
                {
                    ScriptEngine engine = new ScriptEngine(this.Language, null);
                    newUserAndLogin.Execute(engine.Compile(this.Directory));
                }

                if (MigrationsAssemblyPath != null)
                {
                    Assembly asm = Assembly.LoadFrom(this.MigrationsAssemblyPath);
                    newUserAndLogin.Execute(asm);
                }
                else if (Settings != null)
                {
                    newUserAndLogin.Execute(Settings.ToDictionary());
                }
            }
            catch (Exception e)
            {
                ThrowTerminatingError(
                    new ErrorRecord(
                        e,
                        "New-DatabaseUserAndLogin",
                        ErrorCategory.NotSpecified,
                        this
                        )
                    );
            }
        }