Esempio n. 1
0
        public void Setup()
        {
            _register = RegisterFactory.Create();

            var composition = new Composition(_register, new TypeLoader(), Mock.Of <IProfilingLogger>(), ComponentTests.MockRuntimeState(RuntimeLevel.Run));

            composition.Register(_ => Mock.Of <ILogger>());
            composition.Register(_ => Mock.Of <IDataTypeService>());
            composition.Register(_ => Mock.Of <IContentSection>());
            composition.RegisterUnique <IMediaPathScheme, UniqueMediaPathScheme>();

            composition.Configs.Add(SettingsForTests.GetDefaultGlobalSettings);
            composition.Configs.Add(SettingsForTests.GetDefaultUmbracoSettings);

            composition.ComposeFileSystems();

            composition.Configs.Add(SettingsForTests.GetDefaultUmbracoSettings);

            _factory = composition.CreateFactory();

            Current.Reset();
            Current.Factory = _factory;

            // make sure we start clean
            // because some tests will create corrupt or weird filesystems
            FileSystems.Reset();
        }
Esempio n. 2
0
        public void TearDown()
        {
            // stay clean (see note in Setup)
            FileSystems.Reset();

            Current.Reset();
            _register.DisposeIfDisposable();
        }