public override void SetUp()
        {
            base.SetUp();

            SafeCallContext.Clear();
            ClearFiles();
        }
 public override void TearDown()
 {
     base.TearDown();
     SafeCallContext.Clear();
     FileSystems.ResetShadowId();
     ClearFiles();
 }
Example #3
0
        public override void Initialize()
        {
            base.Initialize();

            SafeCallContext.Clear();
            ClearFiles();
        }
Example #4
0
        private static void Reset()
        {
            // reset settings
            SettingsForTests.Reset();

            // clear the logical call context
            SafeCallContext.Clear();
        }
Example #5
0
        public void Setup()
        {
            // bah
            SafeCallContext.Clear();

            _dbContext = new DatabaseContext(
                new ScopeProvider(new DefaultDatabaseFactory(Constants.System.UmbracoConnectionName, Mock.Of <ILogger>())),
                Mock.Of <ILogger>(), new SqlCeSyntaxProvider(), Constants.DatabaseProviders.SqlCe);

            //unfortunately we have to set this up because the PetaPocoExtensions require singleton access
            ApplicationContext.Current = new ApplicationContext(
                CacheHelper.CreateDisabledCacheHelper(),
                new ProfilingLogger(Mock.Of <ILogger>(), Mock.Of <IProfiler>()))
            {
                DatabaseContext = _dbContext,
                IsReady         = true
            };
        }
Example #6
0
        public override void Initialize()
        {
            InitializeFirstRunFlags();

            var path = TestHelper.CurrentAssemblyDirectory;

            AppDomain.CurrentDomain.SetData("DataDirectory", path);

            // we probably don't need this here, as it's done in base.Initialize() already,
            // but these test classes are all weird, not going to change it now - v8
            SafeCallContext.Clear();

            _dbFactory = new DefaultDatabaseFactory(
                GetDbConnectionString(),
                GetDbProviderName(),
                Logger);

            // ensure we start tests in a clean state ie without any scope in context
            // anything that used a true 'Scope' would have removed it, but there could
            // be a rogue 'NoScope' there - and we want to make sure it is gone
            var scopeProvider = new ScopeProvider(null);

            if (scopeProvider.AmbientScope != null)
            {
                scopeProvider.AmbientScope.Dispose(); // removes scope from context
            }
            base.Initialize();

            using (ProfilingLogger.TraceDuration <BaseDatabaseFactoryTest>("init"))
            {
                //TODO: Somehow make this faster - takes 5s +

                DatabaseContext.Initialize(_dbFactory.ProviderName, _dbFactory.ConnectionString);
                CreateSqlCeDatabase();
                InitializeDatabase();

                //ensure the configuration matches the current version for tests
                SettingsForTests.ConfigurationStatus = UmbracoVersion.GetSemanticVersion().ToSemanticString();
            }
        }
Example #7
0
 public void TearDown()
 {
     SafeCallContext.Clear();
     ClearFiles();
     FileSystems.ResetShadowId();
 }
 public void SetUp()
 {
     SafeCallContext.Clear();
     ClearFiles();
     ShadowFileSystems.ResetId();
 }
Example #9
0
 public override void TearDown()
 {
     base.TearDown();
     SafeCallContext.Clear();
     ClearFiles();
 }
 public void Setup()
 {
     SafeCallContext.Clear();
 }
Example #11
0
 public void TearDown()
 {
     SafeCallContext.Clear();
 }