public virtual void FixtureSetup() { var serviceContext = new ServiceContext(new PetaPocoUnitOfWorkProvider()); _dbPreTestDataWorker = new DbPreTestDataWorker(serviceContext); if (!GatewayProviderResolver.HasCurrent) GatewayProviderResolver.Current = new GatewayProviderResolver( PluginManager.Current.ResolveGatewayProviders(), serviceContext.GatewayProviderService, new NullCacheProvider()); MerchelloContext = new MerchelloContext(serviceContext, new GatewayContext(serviceContext, GatewayProviderResolver.Current), new CacheHelper(new NullCacheProvider(), new NullCacheProvider(), new NullCacheProvider())); if (!TriggerResolver.HasCurrent) TriggerResolver.Current = new TriggerResolver(PluginManager.Current.ResolveObservableTriggers()); if (!MonitorResolver.HasCurrent) MonitorResolver.Current = new MonitorResolver(MerchelloContext.Gateways.Notification, PluginManager.Current.ResolveObserverMonitors()); AutoMapperMappings.CreateMappings(); ExamineManager.Instance.IndexProviderCollection["MerchelloProductIndexer"].RebuildIndex(); }
/// <summary> /// Assists in unit testing /// </summary> /// <returns></returns> protected static IMerchelloContext GetMerchelloContext() { var serviceContext = new ServiceContext(new PetaPocoUnitOfWorkProvider()); return MerchelloContext.Current ?? new MerchelloContext(serviceContext, new GatewayContext(serviceContext, GatewayProviderResolver.Current), new CacheHelper(new NullCacheProvider(), new NullCacheProvider(), new NullCacheProvider())); }
public static IMerchelloContext GetMerchelloContext() { var syntax = (DbSyntax)Enum.Parse(typeof(DbSyntax), ConfigurationManager.AppSettings["syntax"]); // sets up the Umbraco SqlSyntaxProvider Singleton SqlSyntaxProviderTestHelper.EstablishSqlSyntax(syntax); var serviceContext = new ServiceContext(new RepositoryFactory(), new PetaPocoUnitOfWorkProvider(new Mock<ILogger>().Object), new Mock<ILogger>().Object, new TransientMessageFactory()); return new MerchelloContext(serviceContext, new GatewayContext(serviceContext, GatewayProviderResolver.Current), new CacheHelper(new NullCacheProvider(), new NullCacheProvider(), new NullCacheProvider())); }
public virtual void FixtureSetup() { var syntax = (DbSyntax)Enum.Parse(typeof(DbSyntax), ConfigurationManager.AppSettings["syntax"]); // sets up the Umbraco SqlSyntaxProvider Singleton OBSOLETE SqlSyntaxProviderTestHelper.EstablishSqlSyntax(syntax); var sqlSyntax = SqlSyntaxProviderTestHelper.SqlSyntaxProvider(syntax); //AutoMapperMappings.CreateMappings(); var logger = Logger.CreateWithDefaultLog4NetConfiguration(); var cache = new CacheHelper( new ObjectCacheRuntimeCacheProvider(), new StaticCacheProvider(), new NullCacheProvider()); var serviceContext = new ServiceContext(new RepositoryFactory(cache, logger, sqlSyntax), new PetaPocoUnitOfWorkProvider(logger), logger, new TransientMessageFactory()); _dbPreTestDataWorker = new DbPreTestDataWorker(serviceContext); // Umbraco Application var applicationMock = new Mock<UmbracoApplication>(); // Merchello CoreBootStrap var bootManager = new Web.WebBootManager(logger, _dbPreTestDataWorker.SqlSyntaxProvider); bootManager.Initialize(); if (MerchelloContext.Current == null) Assert.Ignore("MerchelloContext.Current is null"); //if (!GatewayProviderResolver.HasCurrent) // GatewayProviderResolver.Current = new GatewayProviderResolver( // PluginManager.Current.ResolveGatewayProviders(), // serviceContext.GatewayProviderService, // new NullCacheProvider()); //MerchelloContext = new MerchelloContext(serviceContext, // new GatewayContext(serviceContext, GatewayProviderResolver.Current), // new CacheHelper(new NullCacheProvider(), // new NullCacheProvider(), // new NullCacheProvider())); //if (!TriggerResolver.HasCurrent) // TriggerResolver.Current = new TriggerResolver(PluginManager.Current.ResolveObservableTriggers()); //if (!MonitorResolver.HasCurrent) // MonitorResolver.Current = new MonitorResolver(MerchelloContext.Gateways.Notification, PluginManager.Current.ResolveObserverMonitors()); ExamineManager.Instance.IndexProviderCollection["MerchelloProductIndexer"].RebuildIndex(); ExamineManager.Instance.IndexProviderCollection["MerchelloCustomerIndexer"].RebuildIndex(); }
public DbPreTestDataWorker(ServiceContext serviceContext) { this.SqlSyntaxProvider = serviceContext.SqlSyntax; var uowProvider = new PetaPocoUnitOfWorkProvider(new Mock<ILogger>().Object); Database = uowProvider.GetUnitOfWork().Database; _serviceContext = serviceContext; WarehouseCatalog = new WarehouseCatalog(Constants.DefaultKeys.Warehouse.DefaultWarehouseKey) { Key = Constants.DefaultKeys.Warehouse.DefaultWarehouseCatalogKey }; }
public static IMerchelloContext GetMerchelloContext() { var syntax = (DbSyntax)Enum.Parse(typeof(DbSyntax), ConfigurationManager.AppSettings["syntax"]); // sets up the Umbraco SqlSyntaxProvider Singleton SqlSyntaxProviderTestHelper.EstablishSqlSyntax(syntax); var mockGatewayProviderResolver = new Mock<IGatewayProviderResolver>(MockBehavior.Loose); var serviceContext = new ServiceContext(new PetaPocoUnitOfWorkProvider()); return new MerchelloContext(serviceContext, new GatewayContext(serviceContext, GatewayProviderResolver.Current), new CacheHelper(new NullCacheProvider(), new NullCacheProvider(), new NullCacheProvider())); }
public DbPreTestDataWorker(ServiceContext serviceContext) { var syntax = (DbSyntax)Enum.Parse(typeof (DbSyntax), ConfigurationManager.AppSettings["syntax"]); // sets up the Umbraco SqlSyntaxProvider Singleton SqlSyntaxProviderTestHelper.EstablishSqlSyntax(syntax); var uowProvider = new PetaPocoUnitOfWorkProvider(); Database = uowProvider.GetUnitOfWork().Database; _serviceContext = serviceContext; WarehouseCatalog = new WarehouseCatalog(Constants.DefaultKeys.Warehouse.DefaultWarehouseKey) { Key = Constants.DefaultKeys.Warehouse.DefaultWarehouseCatalogKey }; }
public override IBootManager Initialize() { if (_isInitialized) throw new InvalidOperationException("The Merchello core boot manager has already been initialized"); OnMerchelloInit(); _timer = DisposableTimer.DebugDuration<CoreBootManager>("Merchello starting", "Merchello startup complete"); // create the service context for the MerchelloAppContext var connString = ConfigurationManager.ConnectionStrings[MerchelloConfiguration.Current.Section.DefaultConnectionStringName].ConnectionString; var providerName = ConfigurationManager.ConnectionStrings[MerchelloConfiguration.Current.Section.DefaultConnectionStringName].ProviderName; var serviceContext = new ServiceContext(new PetaPocoUnitOfWorkProvider(connString, providerName)); CreateMerchelloContext(serviceContext); _isInitialized = true; return this; }
public DbPreTestDataWorker() { var syntax = (DbSyntax)Enum.Parse(typeof(DbSyntax), ConfigurationManager.AppSettings["syntax"]); // sets up the Umbraco SqlSyntaxProvider Singleton OBSOLETE SqlSyntaxProviderTestHelper.EstablishSqlSyntax(syntax); this.SqlSyntaxProvider = SqlSyntaxProviderTestHelper.SqlSyntaxProvider(syntax); var uowProvider = new PetaPocoUnitOfWorkProvider(new Mock<ILogger>().Object); Database = uowProvider.GetUnitOfWork().Database; TestLogger = Logger.CreateWithDefaultLog4NetConfiguration(); _serviceContext = new ServiceContext(new RepositoryFactory(), new PetaPocoUnitOfWorkProvider(TestLogger), TestLogger, new TransientMessageFactory()); WarehouseCatalog = new WarehouseCatalog(Constants.DefaultKeys.Warehouse.DefaultWarehouseKey) { Key = Constants.DefaultKeys.Warehouse.DefaultWarehouseCatalogKey }; }
public static IMerchelloContext GetMerchelloContext() { var syntax = (DbSyntax)Enum.Parse(typeof(DbSyntax), ConfigurationManager.AppSettings["syntax"]); // sets up the Umbraco SqlSyntaxProvider Singleton SqlSyntaxProviderTestHelper.EstablishSqlSyntax(syntax); var sqlSyntax = SqlSyntaxProviderTestHelper.SqlSyntaxProvider(syntax); //AutoMapperMappings.CreateMappings(); var logger = Logger.CreateWithDefaultLog4NetConfiguration(); var cache = new CacheHelper( new ObjectCacheRuntimeCacheProvider(), new StaticCacheProvider(), new NullCacheProvider()); var serviceContext = new ServiceContext(new RepositoryFactory(cache, logger, sqlSyntax), new PetaPocoUnitOfWorkProvider(new Mock<ILogger>().Object), new Mock<ILogger>().Object, new TransientMessageFactory()); return new MerchelloContext(serviceContext, new GatewayContext(serviceContext, GatewayProviderResolver.Current), new CacheHelper(new NullCacheProvider(), new NullCacheProvider(), new NullCacheProvider())); }
public virtual void FixtureSetup() { //AutoMapperMappings.CreateMappings(); var logger = Logger.CreateWithDefaultLog4NetConfiguration(); var serviceContext = new ServiceContext(new RepositoryFactory(), new PetaPocoUnitOfWorkProvider(logger), logger, new TransientMessageFactory()); _dbPreTestDataWorker = new DbPreTestDataWorker(serviceContext); // Umbraco Application var applicationMock = new Mock<UmbracoApplication>(); // Merchello CoreBootStrap var bootManager = new Web.WebBootManager(logger); bootManager.Initialize(); if (MerchelloContext.Current == null) Assert.Ignore("MerchelloContext.Current is null"); //if (!GatewayProviderResolver.HasCurrent) // GatewayProviderResolver.Current = new GatewayProviderResolver( // PluginManager.Current.ResolveGatewayProviders(), // serviceContext.GatewayProviderService, // new NullCacheProvider()); //MerchelloContext = new MerchelloContext(serviceContext, // new GatewayContext(serviceContext, GatewayProviderResolver.Current), // new CacheHelper(new NullCacheProvider(), // new NullCacheProvider(), // new NullCacheProvider())); //if (!TriggerResolver.HasCurrent) // TriggerResolver.Current = new TriggerResolver(PluginManager.Current.ResolveObservableTriggers()); //if (!MonitorResolver.HasCurrent) // MonitorResolver.Current = new MonitorResolver(MerchelloContext.Gateways.Notification, PluginManager.Current.ResolveObserverMonitors()); ExamineManager.Instance.IndexProviderCollection["MerchelloProductIndexer"].RebuildIndex(); ExamineManager.Instance.IndexProviderCollection["MerchelloCustomerIndexer"].RebuildIndex(); }
public override IBootManager Initialize() { if (_isInitialized) throw new InvalidOperationException("The Merchello core boot manager has already been initialized"); OnMerchelloInit(); _timer = DisposableTimer.DebugDuration<CoreBootManager>("Merchello starting", "Merchello startup complete"); // create the service context for the MerchelloAppContext var connString = ConfigurationManager.ConnectionStrings[MerchelloConfiguration.Current.Section.DefaultConnectionStringName].ConnectionString; var providerName = ConfigurationManager.ConnectionStrings[MerchelloConfiguration.Current.Section.DefaultConnectionStringName].ProviderName; _unitOfWorkProvider = new PetaPocoUnitOfWorkProvider(connString, providerName); var serviceContext = new ServiceContext(_unitOfWorkProvider); var cache = ApplicationContext.Current == null ? new CacheHelper( new ObjectCacheRuntimeCacheProvider(), new StaticCacheProvider(), new NullCacheProvider()) : ApplicationContext.Current.ApplicationCache; InitializeGatewayResolver(serviceContext, cache); CreateMerchelloContext(serviceContext, cache); InitializeResolvers(); _isInitialized = true; return this; }
/// <summary> /// Creates the MerchelloPluginContext (singleton) /// </summary> /// <param name="serviceContext"></param> /// <param name="cache"></param> /// <remarks> /// Since we load fire our boot manager after Umbraco fires its "started" even, Merchello gets the benefit /// of allowing Umbraco to manage the various caching providers via the Umbraco CoreBootManager or WebBootManager /// depending on the context. /// </remarks> protected void CreateMerchelloContext(ServiceContext serviceContext, CacheHelper cache) { var gateways = new GatewayContext(serviceContext, GatewayProviderResolver.Current); _merchelloContext = MerchelloContext.Current = new MerchelloContext(serviceContext, gateways, cache); }
/// <summary> /// Creates the MerchelloPluginContext (singleton) /// </summary> /// <param name="serviceContext"></param> /// <remarks> /// Since we load fire our boot manager after Umbraco fires its "started" even, Merchello gets the benefit /// of allowing Umbraco to manage the various caching providers via the Umbraco CoreBootManager or WebBootManager /// depending on the context. /// </remarks> protected void CreateMerchelloContext(ServiceContext serviceContext) { // TODO: Mock the ApplicationContext. ApplicationContext should never be null but we need this for unit testing at this point var cache = ApplicationContext.Current == null ? new CacheHelper( new ObjectCacheRuntimeCacheProvider(), new StaticCacheProvider(), new NullCacheProvider()) : ApplicationContext.Current.ApplicationCache; MerchelloContext = MerchelloContext.Current = new MerchelloContext(serviceContext, cache, _isTest); }