示例#1
0
 public void Init() {
     var builder = new ContainerBuilder();
     builder.RegisterType<RubyScriptingRuntime>().As<IScriptingRuntime>();
     builder.RegisterType<ScriptingManager>().As<IScriptingManager>();
     _container = builder.Build();
     _scriptingRuntime = _container.Resolve<IScriptingRuntime>();
     _scriptingManager = _container.Resolve<IScriptingManager>();
     _tempFolderName = _tempFixtureFolderName.Combine(System.IO.Path.GetRandomFileName());
     try {
         _tempFolderName.Delete();
     }
     catch { }
     _tempFolderName.CreateDirectory();
 }
示例#2
0
        public void Init()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <RubyScriptingRuntime>().As <IScriptingRuntime>();
            builder.RegisterType <ScriptingManager>().As <IScriptingManager>();
            _container        = builder.Build();
            _scriptingRuntime = _container.Resolve <IScriptingRuntime>();
            _scriptingManager = _container.Resolve <IScriptingManager>();
            _tempFolderName   = _tempFixtureFolderName.Combine(System.IO.Path.GetRandomFileName());
            try {
                _tempFolderName.Delete();
            }
            catch { }
            _tempFolderName.CreateDirectory();
        }
        public void CreateDb()
        {
            var types = new[] {
                typeof(BlogRecord),
                typeof(BodyRecord),
                typeof(BlogArchiveRecord),
                typeof(ContentItemVersionRecord),
                typeof(ContentItemRecord),
                typeof(ContentTypeRecord)
            };

            _tempFolderName = _tempFixtureFolderName.Combine(System.IO.Path.GetRandomFileName());
            try {
                _tempFixtureFolderName.Delete(true);
            } catch {}
            _tempFixtureFolderName.CreateDirectory();
            _sessionFactory = DataUtility.CreateSessionFactory(
                _tempFolderName, types);

            var builder = new ContainerBuilder();

            _folders = new StubFolders();

            var manager = (IDataServicesProviderFactory) new DataServicesProviderFactory(new[] {
                new Meta <CreateDataServicesProvider>(
                    (dataFolder, connectionString) => new SqlCeDataServicesProvider(dataFolder, connectionString),
                    new Dictionary <string, object> {
                    { "ProviderName", "SqlCe" }
                })
            });

            builder.RegisterInstance(new ShellSettings {
                Name = ShellSettings.DefaultName, DataTablePrefix = "TEST", DataProvider = "SqlCe"
            });
            builder.RegisterInstance(AppDataFolderTests.CreateAppDataFolder(_tempFixtureFolderName)).As <IAppDataFolder>();
            builder.RegisterType <SessionConfigurationCache>().As <ISessionConfigurationCache>();
            builder.RegisterType <SqlCeDataServicesProvider>().As <IDataServicesProvider>();
            builder.RegisterInstance(manager).As <IDataServicesProviderFactory>();
            builder.RegisterType <NullInterpreter>().As <IDataMigrationInterpreter>();
            builder.RegisterType <SessionFactoryHolder>().As <ISessionFactoryHolder>();
            builder.RegisterType <DefaultDatabaseCacheConfiguration>().As <IDatabaseCacheConfiguration>();
            builder.RegisterType <CompositionStrategy>().As <ICompositionStrategy>();
            builder.RegisterInstance(_folders).As <IExtensionFolders>();
            builder.RegisterType <StubLoaders>().As <IExtensionLoader>();
            builder.RegisterType <ExtensionManager>().As <IExtensionManager>();
            builder.RegisterType <SchemaCommandGenerator>().As <ISchemaCommandGenerator>();
            builder.RegisterGeneric(typeof(Repository <>)).As(typeof(IRepository <>));
            builder.RegisterType <StubCacheManager>().As <ICacheManager>();
            builder.RegisterType <StubParallelCacheContext>().As <IParallelCacheContext>();
            builder.RegisterType <StubAsyncTokenProvider>().As <IAsyncTokenProvider>();
            builder.RegisterType <StubHostEnvironment>().As <IHostEnvironment>();

            _session = _sessionFactory.OpenSession();
            builder.RegisterInstance(new DefaultContentManagerTests.TestSessionLocator(_session)).As <ISessionLocator>();

            builder.RegisterInstance(new ShellBlueprint());

            _container = builder.Build();
            _generator = _container.Resolve <ISchemaCommandGenerator>();

            _folders.Manifests.Add("Feature1", @"
Name: Module1
Version: 0.1
CoeveryVersion: 1
Features:
    Feature1: 
        Description: Feature
");
        }