private static void SetupHostingEnvironment(string applicationPath) { var hostingEnvironment = new TestHostingEnvironment { ApplicationVirtualPath = "/", ApplicationPhysicalPath = applicationPath }; GenericHostingEnvironment.Instance = hostingEnvironment; var fallbackMapPathVppConfig = new NameValueCollection { {"physicalPath", AppDomain.CurrentDomain.BaseDirectory}, {"virtualPath", "~/"} }; var fallbackVpp = new VirtualPathNonUnifiedProvider("fallbackMapPathVpp", fallbackMapPathVppConfig); hostingEnvironment.RegisterVirtualPathProvider(fallbackVpp); }
private static void SetupHostingEnvironment(string applicationPath) { var hostingEnvironment = new TestHostingEnvironment { ApplicationVirtualPath = "/", ApplicationPhysicalPath = applicationPath }; GenericHostingEnvironment.Instance = hostingEnvironment; var fallbackMapPathVppConfig = new NameValueCollection { { "physicalPath", AppDomain.CurrentDomain.BaseDirectory }, { "virtualPath", "~/" } }; var fallbackVpp = new VirtualPathNonUnifiedProvider("fallbackMapPathVpp", fallbackMapPathVppConfig); hostingEnvironment.RegisterVirtualPathProvider(fallbackVpp); }
public void Initialize() { //_progressMessenger = progressMessenger; try { TestHostingEnvironment t = new TestHostingEnvironment(); ContentPath = t.MapPath("Content"); //_progressMessenger.AddProgressMessageText("Importing product assets...", false, 0); //ImportAssets(Path.Combine(ContentPath, @"ProductAssets.episerverdata")); //_progressMessenger.AddProgressMessageText("Enabling currencies...", false, 0); EnableCurrencies(); //_progressMessenger.AddProgressMessageText("Importing catalog...", false, 0); ImportCatalog(Path.Combine(ContentPath, @"Catalog_Fashion.zip")); //_progressMessenger.AddProgressMessageText("Disabling default market...", false, 0); DisableDefaultMarket(); //_progressMessenger.AddProgressMessageText("Configuring payment methods", false, 0); ConfigurePaymentMethods(); //_progressMessenger.AddProgressMessageText("Configuring shipment methods", false, 0); ConfigureShippingMethods(); //_progressMessenger.AddProgressMessageText("Creating marketing campaigns and Promotions", false, 0); ConfigureMarketing(); //_progressMessenger.AddProgressMessageText("Rebuilding index...", false, 0); BuildIndex(AppContext.Current.ApplicationId, AppContext.Current.ApplicationName, true); //_progressMessenger.AddProgressMessageText("Done rebuilding index", false, 0); //return true; } catch (Exception ex) { //_progressMessenger.AddProgressMessageText("ImportSiteContent failed: " + ex.Message + "Stack trace:" + ex.StackTrace, true, 0); LogManager.GetLogger(GetType()).Error(ex.Message, ex.StackTrace); //return false; } }