Fixing functional tests using "I have enabled" steps

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-10-05 10:54:57 -07:00
parent 26144f339c
commit 358e242e2a

View File

@@ -1,4 +1,5 @@
using System.Web;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Autofac;
@@ -8,6 +9,7 @@ using Orchard.Environment.Configuration;
namespace Orchard.Specs.Hosting.Orchard.Web {
public class MvcApplication : HttpApplication {
private static IOrchardHost _host;
private static IContainer _container;
public static void RegisterRoutes(RouteCollection routes) {
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
@@ -15,7 +17,8 @@ namespace Orchard.Specs.Hosting.Orchard.Web {
protected void Application_Start() {
RegisterRoutes(RouteTable.Routes);
_host = OrchardStarter.CreateHost(MvcSingletons);
_container = OrchardStarter.CreateHostContainer(MvcSingletons);
_host = _container.Resolve<IOrchardHost>();
_host.Initialize();
@@ -44,11 +47,14 @@ namespace Orchard.Specs.Hosting.Orchard.Web {
}
public static IWorkContextScope CreateStandaloneEnvironment(string name) {
var settings = new ShellSettings {
Name = name,
State = new TenantState("Uninitialized")
};
var settings = _container.Resolve<IShellSettingsManager>().LoadSettings().SingleOrDefault(x => x.Name == name);
if (settings == null) {
settings = new ShellSettings {
Name = name,
State = new TenantState("Uninitialized")
};
}
return _host.CreateStandaloneEnvironment(settings);
}
}