public void Manages_database()
		{
			var settings = new ConnectionSettings("server", "db", true, null, null);
            var scriptDirectory = @"c:\scripts"; 
            var taskAttributes = new TaskAttributes(settings, scriptDirectory);

			var mocks = new MockRepository();
			var taskObserver = mocks.CreateMock<ITaskObserver>();
			var generator = mocks.CreateMock<ILogMessageGenerator>();
			var factory = mocks.CreateMock<IDatabaseActionExecutorFactory>();

			var creator = mocks.CreateMock<IDatabaseActionExecutor>();
			var updater = mocks.CreateMock<IDatabaseActionExecutor>();

			var executors = new IDatabaseActionExecutor[] { creator, updater };

			using (mocks.Record())
			{
				Expect.Call(generator.GetInitialMessage(taskAttributes)).Return("starting...");
				taskObserver.Log("starting...");
				Expect.Call(factory.GetExecutors(RequestedDatabaseAction.Create)).Return(executors);

                creator.Execute(taskAttributes, taskObserver);
                updater.Execute(taskAttributes, taskObserver);
			}

			using (mocks.Playback())
			{
				ISqlDatabaseManager manager = new SqlDatabaseManager(generator, factory);

				manager.Upgrade(taskAttributes, taskObserver);
			}

			mocks.VerifyAll();
		}
        public bool UpdateDatabase(ConnectionSettings settings, string scriptDirectory, RequestedDatabaseAction action)
        {
            var manager = new SqlDatabaseManager();
            
            var taskAttributes = new TaskAttributes(settings, scriptDirectory)
                                     {
                                         RequestedDatabaseAction = action,
                                     };
            try
            {
                manager.Upgrade(taskAttributes, this);

                foreach (var property in _properties)
                {
                    Log(property.Key +": " + property.Value);
                }
                return true;
            }
            catch (Exception exception)
            {                
                var ex = exception;
                do
                {
                    Log("Failure: " + ex.Message);
                    ex = ex.InnerException;    
                } while (ex!=null);

                //Log(exception.ToString());
                

            }
            return false;
        }
        protected override void ExecuteTask()
		{
			try
			{
			    var manager = new SqlDatabaseManager();
                var settings = new ConnectionSettings(Server, Database, IntegratedAuthentication, Username, Password);
                var taskAttributes = new TaskAttributes(settings, ScriptDirectory.FullName)
                                         {
                                             SkipFileNameContaining = SkipFileNameContaining,
                                             RequestedDatabaseAction = Action,
                                         };

                manager.Upgrade(taskAttributes, this);
			}
			catch
			{
				if (FailOnError)
					throw;
			}
		}
        public void Should_create_a_new_instance_without_IoC()
       {
           var manager = new SqlDatabaseManager();

       }