/// <summary> /// Tries to find the document matching the request, by running the IPublishedContentFinder instances. /// </summary> /// <exception cref="InvalidOperationException">There is no finder collection.</exception> internal void FindPublishedContent() { const string tracePrefix = "FindPublishedContent: "; // look for the document // the first successful finder, if any, will set this.PublishedContent, and may also set this.Template // some finders may implement caching using (ProfilingLogger.DebugDuration <PublishedContentRequestEngine>( string.Format("{0}Begin finders", tracePrefix), string.Format("{0}End finders, {1}", tracePrefix, (_pcr.HasPublishedContent ? "a document was found" : "no document was found")))) { if (_routingContext.PublishedContentFinders == null) { throw new InvalidOperationException("There is no finder collection."); } //iterate but return on first one that finds it var found = _routingContext.PublishedContentFinders.Any(finder => finder.TryFindContent(_pcr)); } // indicate that the published content (if any) we have at the moment is the // one that was found by the standard finders before anything else took place. _pcr.SetIsInitialPublishedContent(); }
public PureLiveModelFactory(ProfilingLogger logger) { _logger = logger; _ver = 1; // zero is for when we had no version ContentTypeCacheRefresher.CacheUpdated += (sender, args) => ResetModels(); DataTypeCacheRefresher.CacheUpdated += (sender, args) => ResetModels(); RazorBuildProvider.CodeGenerationStarted += RazorBuildProvider_CodeGenerationStarted; if (!HostingEnvironment.IsHosted) { return; } var appData = HostingEnvironment.MapPath("~/App_Data"); if (appData == null) { throw new Exception("Panic: appData is null."); } var modelsDirectory = Path.Combine(appData, "Models"); if (!Directory.Exists(modelsDirectory)) { Directory.CreateDirectory(modelsDirectory); } // BEWARE! if the watcher is not properly released then for some reason the // BuildManager will start confusing types - using a 'registered object' here // though we should probably plug into Umbraco's MainDom - which is internal HostingEnvironment.RegisterObject(this); _watcher = new FileSystemWatcher(modelsDirectory); _watcher.Changed += WatcherOnChanged; _watcher.EnableRaisingEvents = true; }
public void Can_Bulk_Insert() { // Arrange var db = DatabaseContext.Database; var servers = new List <ServerRegistrationDto>(); for (var i = 0; i < 1000; i++) { servers.Add(new ServerRegistrationDto { ServerAddress = "address" + i, ServerIdentity = "computer" + i, DateRegistered = DateTime.Now, IsActive = true, DateAccessed = DateTime.Now }); } // Act using (ProfilingLogger.TraceDuration <PetaPocoExtensionsTest>("starting insert", "finished insert")) { db.BulkInsertRecords(servers); } // Assert Assert.That(db.ExecuteScalar <int>("SELECT COUNT(*) FROM umbracoServer"), Is.EqualTo(1000)); }
public override void Initialize() { InitializeFirstRunFlags(); var path = TestHelper.CurrentAssemblyDirectory; AppDomain.CurrentDomain.SetData("DataDirectory", path); _dbFactory = new Umbraco.Core.Persistence.DefaultDatabaseFactory( GetDbConnectionString(), GetDbProviderName(), Logger); //_dbFactory.ResetForTests(); 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(); } }
public void Can_Bulk_Insert_One_By_One_Transaction_Rollback() { // Arrange var db = DatabaseContext.Database; var servers = new List <ServerRegistrationDto>(); for (var i = 0; i < 1000; i++) { servers.Add(new ServerRegistrationDto { ServerAddress = "address" + i, ServerIdentity = "computer" + i, DateRegistered = DateTime.Now, IsActive = true, DateAccessed = DateTime.Now }); } // Act using (ProfilingLogger.TraceDuration <PetaPocoExtensionsTest>("starting insert", "finished insert")) { using (var tr = db.GetTransaction()) { db.BulkInsertRecords(servers, tr, SqlSyntax, useNativeSqlPlatformBulkInsert: false); //don't call complete here - the trans will be rolled back } } // Assert Assert.That(db.ExecuteScalar <int>("SELECT COUNT(*) FROM umbracoServer"), Is.EqualTo(0)); }
public PureLiveModelFactory(Lazy <UmbracoServices> umbracoServices, ProfilingLogger logger) { _umbracoServices = umbracoServices; _logger = logger; _ver = 1; // zero is for when we had no version _skipver = -1; // nothing to skip ContentTypeCacheRefresher.CacheUpdated += (sender, args) => ResetModels(); DataTypeCacheRefresher.CacheUpdated += (sender, args) => ResetModels(); RazorBuildProvider.CodeGenerationStarted += RazorBuildProvider_CodeGenerationStarted; if (!HostingEnvironment.IsHosted) { return; } var modelsDirectory = UmbracoConfig.For.ModelsBuilder().ModelsDirectory; if (!Directory.Exists(modelsDirectory)) { Directory.CreateDirectory(modelsDirectory); } // BEWARE! if the watcher is not properly released then for some reason the // BuildManager will start confusing types - using a 'registered object' here // though we should probably plug into Umbraco's MainDom - which is internal HostingEnvironment.RegisterObject(this); _watcher = new FileSystemWatcher(modelsDirectory); _watcher.Changed += WatcherOnChanged; _watcher.EnableRaisingEvents = true; // get it here, this need to be fast _debugLevel = UmbracoConfig.For.ModelsBuilder().DebugLevel; }
public TestHelper() : base(typeof(TestHelper).Assembly) { var httpContext = new DefaultHttpContext(); httpContext.Connection.RemoteIpAddress = IPAddress.Parse("127.0.0.1"); _httpContextAccessor = Mock.Of <IHttpContextAccessor>(x => x.HttpContext == httpContext); _ipResolver = new AspNetCoreIpResolver(_httpContextAccessor); string contentRoot = Assembly.GetExecutingAssembly().GetRootDirectorySafe(); // The mock for IWebHostEnvironment has caused a good few issues. // We can UseContentRoot, UseWebRoot etc on the host builder instead. // possibly going down rabbit holes though as would need to cleanup all usages of // GetHostingEnvironment & GetWebHostEnvironment. var hostEnvironment = new Mock <IWebHostEnvironment>(); // This must be the assembly name for the WebApplicationFactory to work. hostEnvironment.Setup(x => x.ApplicationName).Returns(GetType().Assembly.GetName().Name); hostEnvironment.Setup(x => x.ContentRootPath).Returns(() => contentRoot); hostEnvironment.Setup(x => x.ContentRootFileProvider).Returns(() => new PhysicalFileProvider(contentRoot)); hostEnvironment.Setup(x => x.WebRootPath).Returns(() => WorkingDirectory); hostEnvironment.Setup(x => x.WebRootFileProvider).Returns(() => new PhysicalFileProvider(WorkingDirectory)); hostEnvironment.Setup(x => x.EnvironmentName).Returns("Tests"); // We also need to expose it as the obsolete interface since netcore's WebApplicationFactory casts it. hostEnvironment.As <Microsoft.AspNetCore.Hosting.IHostingEnvironment>(); _hostEnvironment = hostEnvironment.Object; _hostingLifetime = new AspNetCoreApplicationShutdownRegistry(Mock.Of <IHostApplicationLifetime>()); ConsoleLoggerFactory = LoggerFactory.Create(builder => builder.AddConsole()); ProfilingLogger = new ProfilingLogger(ConsoleLoggerFactory.CreateLogger <ProfilingLogger>(), Profiler); }
public void Can_Bulk_Insert_One_By_One_Transaction_Rollback() { var servers = new List <ServerRegistrationDto>(); for (var i = 0; i < 1000; i++) { servers.Add(new ServerRegistrationDto { ServerAddress = "address" + i, ServerIdentity = "computer" + i, DateRegistered = DateTime.Now, IsActive = true, DateAccessed = DateTime.Now }); } // Act using (ProfilingLogger.TraceDuration <NPocoBulkInsertTests>("starting insert", "finished insert")) { using (var scope = ScopeProvider.CreateScope()) { scope.Database.BulkInsertRecords(servers, false); //don't call complete here - the trans will be rolled back } } // Assert using (var scope = ScopeProvider.CreateScope()) { Assert.That(scope.Database.ExecuteScalar <int>("SELECT COUNT(*) FROM umbracoServer"), Is.EqualTo(0)); } }
private XmlCacheFilePersister(IBackgroundTaskRunner <XmlCacheFilePersister> runner, content content, ProfilingLogger logger, bool touched) { _runner = runner; _content = content; _logger = logger; if (runner.TryAdd(this) == false) { _runner = null; // runner's down _released = true; // don't mess with timer return; } // runner could decide to run it anytime now if (touched == false) { return; } _logger.Logger.Debug <XmlCacheFilePersister>("Created, save in {0}ms.", () => WaitMilliseconds); _initialTouch = DateTime.Now; _timer = new Timer(_ => TimerRelease()); _timer.Change(WaitMilliseconds, 0); }
/// <summary> /// Constructor /// </summary> /// <param name="dbContext"></param> /// <param name="serviceContext"></param> /// <param name="cache"></param> /// <param name="logger"></param> public ApplicationContext(DatabaseContext dbContext, ServiceContext serviceContext, CacheHelper cache, ProfilingLogger logger) { if (dbContext == null) { throw new ArgumentNullException("dbContext"); } if (serviceContext == null) { throw new ArgumentNullException("serviceContext"); } if (cache == null) { throw new ArgumentNullException("cache"); } if (logger == null) { throw new ArgumentNullException("logger"); } _databaseContext = dbContext; _services = serviceContext; ApplicationCache = cache; ProfilingLogger = logger; Init(); }
public virtual void SetUp() { // should not need this if all other tests were clean // but hey, never know, better avoid garbage-in Reset(); // get/merge the attributes marking the method and/or the classes Options = TestOptionAttributeBase.GetTestOptions <UmbracoTestAttribute>(); // fixme - align to runtimes & components - don't redo everything here var(logger, profiler) = GetLoggers(Options.Logger); var proflogger = new ProfilingLogger(logger, profiler); var cacheHelper = GetCacheHelper(); var globalSettings = SettingsForTests.GetDefaultGlobalSettings(); var typeLoader = GetTypeLoader(cacheHelper.RuntimeCache, globalSettings, proflogger, Options.TypeLoader); var register = RegisterFactory.Create(); Composition = new Composition(register, typeLoader, proflogger, ComponentTests.MockRuntimeState(RuntimeLevel.Run)); Composition.RegisterUnique(typeLoader); Composition.RegisterUnique(logger); Composition.RegisterUnique(profiler); Composition.RegisterUnique <IProfilingLogger>(proflogger); Composition.RegisterUnique(cacheHelper); Composition.RegisterUnique(cacheHelper.RuntimeCache); TestObjects = new TestObjects(register); Compose(); Current.Factory = Factory = Composition.CreateFactory(); Initialize(); }
/// <summary> /// Creates the SqlCe database if required /// </summary> protected virtual void CreateSqlCeDatabase() { if (Options.Database == UmbracoTestOptions.Database.None) { return; } var path = TestHelper.WorkingDirectory; //Get the connectionstring settings from config var settings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; ConfigurationManager.AppSettings.Set( Constants.System.UmbracoConnectionName, GetDbConnectionString()); _databasePath = string.Concat(path, "\\UmbracoNPocoTests.sdf"); //create a new database file if // - is the first test in the session // - the database file doesn't exist // - NewDbFileAndSchemaPerTest // - _isFirstTestInFixture + DbInitBehavior.NewDbFileAndSchemaPerFixture //if this is the first test in the session, always ensure a new db file is created if (FirstTestInSession || File.Exists(_databasePath) == false || Options.Database == UmbracoTestOptions.Database.NewSchemaPerTest || Options.Database == UmbracoTestOptions.Database.NewEmptyPerTest || (FirstTestInFixture && Options.Database == UmbracoTestOptions.Database.NewSchemaPerFixture)) { using (ProfilingLogger.TraceDuration <TestWithDatabaseBase>("Remove database file")) { RemoveDatabaseFile(null, ex => { //if this doesn't work we have to make sure everything is reset! otherwise // well run into issues because we've already set some things up TearDown(); throw ex; }); } //Create the Sql CE database using (ProfilingLogger.TraceDuration <TestWithDatabaseBase>("Create database file")) { if (Options.Database != UmbracoTestOptions.Database.NewEmptyPerTest && _databaseBytes != null) { File.WriteAllBytes(_databasePath, _databaseBytes); } else { using (var engine = new SqlCeEngine(settings.ConnectionString)) { engine.CreateDatabase(); } } } } }
/// <summary> /// Fires after startup and calls the callback once customizations are locked /// </summary> /// <param name="afterComplete"></param> /// <returns></returns> public virtual IBootManager Complete(Action <ApplicationContext> afterComplete) { if (_isComplete) { throw new InvalidOperationException("The boot manager has already been completed"); } FreezeResolution(); //Here we need to make sure the db can be connected to EnsureDatabaseConnection(); //This is a special case for the user service, we need to tell it if it's an upgrade, if so we need to ensure that // exceptions are bubbled up if a user is attempted to be persisted during an upgrade (i.e. when they auth to login) ((UserService)ApplicationContext.Services.UserService).IsUpgrading = true; using (ProfilingLogger.DebugDuration <CoreBootManager>( string.Format("Executing {0} IApplicationEventHandler.OnApplicationStarted", ApplicationEventsResolver.Current.ApplicationEventHandlers.Count()), "Finished executing IApplicationEventHandler.OnApplicationStarted")) { //call OnApplicationStarting of each application events handler ApplicationEventsResolver.Current.ApplicationEventHandlers .ForEach(x => { try { using (ProfilingLogger.DebugDuration <CoreBootManager>(string.Format("Executing {0} in ApplicationStarted", x.GetType()))) { x.OnApplicationStarted(UmbracoApplication, ApplicationContext); } } catch (Exception ex) { ProfilingLogger.Logger.Error <CoreBootManager>("An error occurred running OnApplicationStarted for handler " + x.GetType(), ex); throw; } }); } //Now, startup all of our legacy startup handler ApplicationEventsResolver.Current.InstantiateLegacyStartupHandlers(); if (afterComplete != null) { afterComplete(ApplicationContext.Current); } _isComplete = true; // we're ready to serve content! ApplicationContext.IsReady = true; //stop the timer and log the output _timer.Dispose(); return(this); }
/// <summary> /// Creates the SqlCe database if required /// </summary> protected virtual void CreateSqlCeDatabase() { if (DatabaseTestBehavior == DatabaseBehavior.NoDatabasePerFixture) { return; } var path = TestHelper.CurrentAssemblyDirectory; //Get the connectionstring settings from config var settings = ConfigurationManager.ConnectionStrings[Core.Configuration.GlobalSettings.UmbracoConnectionName]; ConfigurationManager.AppSettings.Set( Core.Configuration.GlobalSettings.UmbracoConnectionName, GetDbConnectionString()); _dbPath = string.Concat(path, "\\UmbracoPetaPocoTests.sdf"); //create a new database file if // - is the first test in the session // - the database file doesn't exist // - NewDbFileAndSchemaPerTest // - _isFirstTestInFixture + DbInitBehavior.NewDbFileAndSchemaPerFixture //if this is the first test in the session, always ensure a new db file is created if (_isFirstRunInTestSession || File.Exists(_dbPath) == false || (DatabaseTestBehavior == DatabaseBehavior.NewDbFileAndSchemaPerTest || DatabaseTestBehavior == DatabaseBehavior.EmptyDbFilePerTest) || (_isFirstTestInFixture && DatabaseTestBehavior == DatabaseBehavior.NewDbFileAndSchemaPerFixture)) { using (ProfilingLogger.TraceDuration <BaseDatabaseFactoryTest>("Remove database file")) { RemoveDatabaseFile(ex => { //if this doesn't work we have to make sure everything is reset! otherwise // well run into issues because we've already set some things up TearDown(); throw ex; }); } //Create the Sql CE database using (ProfilingLogger.TraceDuration <BaseDatabaseFactoryTest>("Create database file")) { if (DatabaseTestBehavior != DatabaseBehavior.EmptyDbFilePerTest && _dbBytes != null) { File.WriteAllBytes(_dbPath, _dbBytes); } else { using (var engine = new SqlCeEngine(settings.ConnectionString)) { engine.CreateDatabase(); } } } } }
/// <summary> /// Overridden for logging. /// </summary> protected override void AddDocument(Document doc, ValueSet valueSet, IndexWriter writer) { ProfilingLogger.Debug <string, string, string>(GetType(), "Write lucene doc id:{DocumentId}, category:{DocumentCategory}, type:{DocumentItemType}", valueSet.Id, valueSet.Category, valueSet.ItemType); base.AddDocument(doc, valueSet, writer); }
public ApplicationContext(CacheHelper cache) { if (cache == null) { throw new ArgumentNullException("cache"); } ApplicationCache = cache; ProfilingLogger = new ProfilingLogger(LoggerResolver.Current.Logger, ProfilerResolver.Current.Profiler); Init(); }
/// <summary> /// Initializes a new instance of the <see cref="PluginManager"/> class. /// </summary> /// <param name="serviceProvider">A mechanism for retrieving service objects.</param> /// <param name="runtimeCache">The application runtime cache.</param> /// <param name="logger">A profiling logger.</param> /// <param name="detectChanges">Whether to detect changes using hashes.</param> internal PluginManager(IServiceProvider serviceProvider, IRuntimeCacheProvider runtimeCache, ProfilingLogger logger, bool detectChanges = true) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } if (runtimeCache == null) { throw new ArgumentNullException("runtimeCache"); } if (logger == null) { throw new ArgumentNullException("logger"); } _serviceProvider = serviceProvider; _runtimeCache = runtimeCache; _logger = logger; // the temp folder where the cache file lives _tempFolder = IOHelper.MapPath("~/App_Data/TEMP/PluginCache"); if (Directory.Exists(_tempFolder) == false) { Directory.CreateDirectory(_tempFolder); } var pluginListFile = GetPluginListFilePath(); if (detectChanges) { //first check if the cached hash is string.Empty, if it is then we need //do the check if they've changed RequiresRescanning = (CachedAssembliesHash != CurrentAssembliesHash) || CachedAssembliesHash == string.Empty; //if they have changed, we need to write the new file if (RequiresRescanning) { // if the hash has changed, clear out the persisted list no matter what, this will force // rescanning of all plugin types including lazy ones. // http://issues.umbraco.org/issue/U4-4789 File.Delete(pluginListFile); WriteCachePluginsHash(); } } else { // if the hash has changed, clear out the persisted list no matter what, this will force // rescanning of all plugin types including lazy ones. // http://issues.umbraco.org/issue/U4-4789 File.Delete(pluginListFile); // always set to true if we're not detecting (generally only for testing) RequiresRescanning = true; } }
private void CreateAndInitializeDatabase() { using (ProfilingLogger.TraceDuration <TestWithDatabaseBase>("Create database.")) { CreateSqlCeDatabase(); // TODO: faster! } using (ProfilingLogger.TraceDuration <TestWithDatabaseBase>("Initialize database.")) { InitializeDatabase(); // TODO: faster! } }
/// <summary> /// Initializes a new instance of the <see cref="NexuService"/> class. /// </summary> /// <param name="profiler"> /// The profiler. /// </param> /// <param name="relationService"> /// The relation Service. /// </param> /// <param name="propertyParserResolver"> /// The property Parser Resolver. /// </param> /// <param name="dataTypeService"> /// The data Type Service. /// </param> public NexuService( ProfilingLogger profiler, IRelationService relationService, PropertyParserResolver propertyParserResolver, IDataTypeService dataTypeService) { this.profiler = profiler; this.relationService = relationService; this.propertyParserResolver = propertyParserResolver; this.dataTypeService = dataTypeService; service = this; }
/// <summary> /// Initializes a new instance of the <see cref="PluginManager"/> class. /// </summary> /// <param name="serviceProvider">A mechanism for retrieving service objects.</param> /// <param name="runtimeCache">The application runtime cache.</param> /// <param name="logger">A profiling logger.</param> /// <param name="detectChanges">Whether to detect changes using hashes.</param> internal PluginManager(IServiceProvider serviceProvider, IRuntimeCacheProvider runtimeCache, ProfilingLogger logger, bool detectChanges = true) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } if (runtimeCache == null) { throw new ArgumentNullException("runtimeCache"); } if (logger == null) { throw new ArgumentNullException("logger"); } _serviceProvider = serviceProvider; _runtimeCache = runtimeCache; _logger = logger; if (detectChanges) { //first check if the cached hash is string.Empty, if it is then we need //do the check if they've changed RequiresRescanning = (CachedAssembliesHash != CurrentAssembliesHash) || CachedAssembliesHash == string.Empty; //if they have changed, we need to write the new file if (RequiresRescanning) { // if the hash has changed, clear out the persisted list no matter what, this will force // rescanning of all plugin types including lazy ones. // http://issues.umbraco.org/issue/U4-4789 if (File.Exists(_pluginListFilePath.Value)) { File.Delete(_pluginListFilePath.Value); } WriteCachePluginsHash(); } } else { // if the hash has changed, clear out the persisted list no matter what, this will force // rescanning of all plugin types including lazy ones. // http://issues.umbraco.org/issue/U4-4789 if (File.Exists(_pluginListFilePath.Value)) { File.Delete(_pluginListFilePath.Value); } // always set to true if we're not detecting (generally only for testing) RequiresRescanning = true; } }
public EmbeddedContentValueConverter( IDataTypeService dataTypeService, IUserService userService, IPublishedContentModelFactory publishedContentModelFactory, ProfilingLogger profilingLogger, Func <UmbracoContext> umbracoContextFactory) { _dataTypeService = dataTypeService; _userService = userService; _publishedContentModelFactory = publishedContentModelFactory; _profilingLogger = profilingLogger; _umbracoContextFactory = umbracoContextFactory; }
internal CoreBootManager(UmbracoApplicationBase umbracoApplication, ProfilingLogger logger) { if (umbracoApplication == null) { throw new ArgumentNullException("umbracoApplication"); } if (logger == null) { throw new ArgumentNullException("logger"); } _umbracoApplication = umbracoApplication; ProfilingLogger = logger; }
public void Initialize() { PackageActionsResolver.Reset(); ProfilingLogger = new ProfilingLogger(Mock.Of <ILogger>(), Mock.Of <IProfiler>()); PluginManager = new PluginManager(new ActivatorServiceProvider(), new NullCacheProvider(), ProfilingLogger, false) { AssembliesToScan = AssembliesToScan }; }
private void DoUnattendedUpgrade(DatabaseBuilder databaseBuilder) { var plan = new UmbracoPlan(); using (ProfilingLogger.TraceDuration <CoreRuntime>("Starting unattended upgrade.", "Unattended upgrade completed.")) { var result = databaseBuilder.UpgradeSchemaAndData(plan); if (result.Success == false) { throw new UnattendedInstallException("An error occurred while running the unattended upgrade.\n" + result.Message); } } }
/// <summary> /// Creates a basic app context /// </summary> /// <param name="cache"></param> /// <param name="logger"></param> public ApplicationContext(CacheHelper cache, ProfilingLogger logger) { if (cache == null) { throw new ArgumentNullException("cache"); } if (logger == null) { throw new ArgumentNullException("logger"); } ApplicationCache = cache; ProfilingLogger = logger; Init(); }
public void Initialize() { var logger = new ProfilingLogger(Mock.Of <ILogger>(), Mock.Of <IProfiler>()); //this ensures its reset _pluginManager = new PluginManager(new ActivatorServiceProvider(), new NullCacheProvider(), logger, false) { AssembliesToScan = new[] { typeof(ContentTypeBase).Assembly } }; }
private IEnumerable <Type> ResolveComposerTypes(TypeLoader typeLoader) { using (var timer = ProfilingLogger.TraceDuration <CoreRuntime>("Resolving composer types.", "Resolved.")) { try { return(GetComposerTypes(typeLoader)); } catch { timer?.Fail(); throw; } } }
private bool AcquireMainDom(IMainDom mainDom) { using (var timer = ProfilingLogger.DebugDuration <CoreRuntime>("Acquiring MainDom.", "Acquired.")) { try { return(mainDom.IsMainDom); } catch { timer?.Fail(); throw; } } }
public EmbeddedContentPropertyEditor( IContentTypeService contentTypeService, IDataTypeService dataTypeService, ICultureDictionary cultureDictionary, ProfilingLogger profilingLogger, PropertyEditorResolver propertyEditorResolver, Func <WebSecurity> securityFactory) { _contentTypeService = contentTypeService; _dataTypeService = dataTypeService; _cultureDictionary = cultureDictionary; _profilingLogger = profilingLogger; _propertyEditorResolver = propertyEditorResolver; _securityFactory = securityFactory; }
public virtual void Initialize() { var logger = new ProfilingLogger(Mock.Of <ILogger>(), Mock.Of <IProfiler>()); SqlSyntaxContext.SqlSyntaxProvider = new SqlCeSyntaxProvider(); PluginManager.Current = new PluginManager(new ActivatorServiceProvider(), new NullCacheProvider(), logger, false); MappingResolver.Current = new MappingResolver( new ActivatorServiceProvider(), logger.Logger, () => PluginManager.Current.ResolveAssignedMapperTypes()); Resolution.Freeze(); SetUp(); }