mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-06-28 15:34:39 +08:00
Integrating SpecFlow
asp.net inprocess appdomain utilized for integration style testing feature files generate nunit tests at "save time" with vs specflow 1.2 installed micro orchard site created dynamically in temp folder as a given step cross-domain delegate invokation based on the excellent work of Steve Sanderson http://blog.stevensanderson.com/ --HG-- branch : dev
This commit is contained in:
parent
52a4a18f3c
commit
c416ed1f53
2430
lib/htmlagilitypack/HtmlAgilityPack.XML
Normal file
2430
lib/htmlagilitypack/HtmlAgilityPack.XML
Normal file
File diff suppressed because it is too large
Load Diff
BIN
lib/htmlagilitypack/HtmlAgilityPack.dll
Normal file
BIN
lib/htmlagilitypack/HtmlAgilityPack.dll
Normal file
Binary file not shown.
BIN
lib/htmlagilitypack/HtmlAgilityPack.pdb
Normal file
BIN
lib/htmlagilitypack/HtmlAgilityPack.pdb
Normal file
Binary file not shown.
70
src/Orchard.Specs/Bindings/WebAppHosting.cs
Normal file
70
src/Orchard.Specs/Bindings/WebAppHosting.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
using System.Web.Hosting;
|
||||
using Orchard.Specs.Hosting;
|
||||
using Orchard.Specs.Util;
|
||||
using TechTalk.SpecFlow;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Orchard.Specs.Bindings {
|
||||
[Binding]
|
||||
public class WebAppHosting {
|
||||
private WebHost _webHost;
|
||||
private RequestDetails _details;
|
||||
|
||||
[Given(@"I have a clean site")]
|
||||
public void GivenIHaveACleanSite() {
|
||||
_webHost = new WebHost();
|
||||
_webHost.Initialize("Orchard.Web", "/");
|
||||
}
|
||||
|
||||
[Given(@"I have module ""(.*)""")]
|
||||
public void GivenIHaveModule(string moduleName) {
|
||||
_webHost.CopyExtension("Modules", moduleName);
|
||||
}
|
||||
|
||||
[Given(@"I have theme ""(.*)""")]
|
||||
public void GivenIHaveTheme(string themeName) {
|
||||
_webHost.CopyExtension("Themes", themeName);
|
||||
}
|
||||
|
||||
[Given(@"I have core ""(.*)""")]
|
||||
public void GivenIHaveCore(string moduleName) {
|
||||
_webHost.CopyExtension("Core", moduleName);
|
||||
}
|
||||
|
||||
[When(@"I go to ""(.*)""")]
|
||||
public void WhenIGoTo(string urlPath) {
|
||||
_details = _webHost.SendRequest(urlPath);
|
||||
}
|
||||
|
||||
[When(@"I follow ""(.*)""")]
|
||||
public void WhenIFollow(string linkText) {
|
||||
var doc = new HtmlAgilityPack.HtmlDocument();
|
||||
doc.Load(new StringReader(_details.ResponseText));
|
||||
var link = doc.DocumentNode.SelectNodes("//a").Single(elt => elt.InnerText == linkText);
|
||||
|
||||
WhenIGoTo(link.Attributes["href"].Value);
|
||||
}
|
||||
|
||||
[Then(@"the status should be (.*) (.*)")]
|
||||
public void ThenTheStatusShouldBe(int statusCode, string statusDescription) {
|
||||
Assert.That(_details.StatusCode, Is.EqualTo(statusCode));
|
||||
Assert.That(_details.StatusDescription, Is.EqualTo(statusDescription));
|
||||
}
|
||||
|
||||
[Then(@"I should see ""(.*)""")]
|
||||
public void ThenIShouldSee(string text) {
|
||||
Assert.That(_details.ResponseText, Is.StringContaining(text));
|
||||
}
|
||||
|
||||
[Then(@"the title contains ""(.*)""")]
|
||||
public void ThenTheTitleContainsText(string text) {
|
||||
ScenarioContext.Current.Pending();
|
||||
}
|
||||
}
|
||||
}
|
1
src/Orchard.Specs/Hosting/Orchard.Web/Content/Static.txt
Normal file
1
src/Orchard.Specs/Hosting/Orchard.Web/Content/Static.txt
Normal file
@ -0,0 +1 @@
|
||||
Hello world!
|
154
src/Orchard.Specs/Hosting/Orchard.Web/Core/Web.config
Normal file
154
src/Orchard.Specs/Hosting/Orchard.Web/Core/Web.config
Normal file
@ -0,0 +1,154 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Note: As an alternative to hand editing this file you can use the
|
||||
web admin tool to configure settings for your application. Use
|
||||
the Website->Asp.Net Configuration option in Visual Studio.
|
||||
A full list of settings and comments can be found in
|
||||
machine.config.comments usually located in
|
||||
\Windows\Microsoft.Net\Framework\v2.x\Config
|
||||
-->
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
|
||||
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
</sectionGroup>
|
||||
</sectionGroup>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
|
||||
<system.web>
|
||||
|
||||
<!--
|
||||
Set compilation debug="true" to insert debugging
|
||||
symbols into the compiled page. Because this
|
||||
affects performance, set this value to true only
|
||||
during development.
|
||||
-->
|
||||
<compilation debug="true">
|
||||
<assemblies>
|
||||
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
||||
</assemblies>
|
||||
</compilation>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
The <customErrors> section enables configuration
|
||||
of what to do if/when an unhandled error occurs
|
||||
during the execution of a request. Specifically,
|
||||
it enables developers to configure html error pages
|
||||
to be displayed in place of a error stack trace.
|
||||
|
||||
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
|
||||
<error statusCode="403" redirect="NoAccess.htm" />
|
||||
<error statusCode="404" redirect="FileNotFound.htm" />
|
||||
</customErrors>
|
||||
-->
|
||||
|
||||
<pages>
|
||||
<controls>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</controls>
|
||||
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc"/>
|
||||
<add namespace="System.Web.Mvc.Ajax"/>
|
||||
<add namespace="System.Web.Mvc.Html"/>
|
||||
<add namespace="System.Web.Routing"/>
|
||||
<add namespace="System.Linq"/>
|
||||
<add namespace="System.Collections.Generic"/>
|
||||
<add namespace="Orchard.Mvc.Html" />
|
||||
</namespaces>
|
||||
</pages>
|
||||
|
||||
<httpHandlers>
|
||||
<remove verb="*" path="*.asmx"/>
|
||||
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
|
||||
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</httpHandlers>
|
||||
|
||||
<httpModules>
|
||||
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</httpModules>
|
||||
|
||||
</system.web>
|
||||
|
||||
<system.codedom>
|
||||
<compilers>
|
||||
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
|
||||
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<providerOption name="CompilerVersion" value="v3.5"/>
|
||||
<providerOption name="WarnAsError" value="false"/>
|
||||
</compiler>
|
||||
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4"
|
||||
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<providerOption name="CompilerVersion" value="v3.5"/>
|
||||
<providerOption name="OptionInfer" value="true"/>
|
||||
<providerOption name="WarnAsError" value="false"/>
|
||||
</compiler>
|
||||
</compilers>
|
||||
</system.codedom>
|
||||
|
||||
<system.web.extensions/>
|
||||
|
||||
<!--
|
||||
The system.webServer section is required for running ASP.NET AJAX under Internet
|
||||
Information Services 7.0. It is not necessary for previous version of IIS.
|
||||
-->
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
|
||||
<modules runAllManagedModulesForAllRequests="true">
|
||||
<remove name="ScriptModule" />
|
||||
<remove name="UrlRoutingModule" />
|
||||
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</modules>
|
||||
|
||||
<handlers>
|
||||
<remove name="WebServiceHandlerFactory-Integrated"/>
|
||||
<remove name="ScriptHandlerFactory" />
|
||||
<remove name="ScriptHandlerFactoryAppServices" />
|
||||
<remove name="ScriptResource" />
|
||||
<remove name="MvcHttpHandler" />
|
||||
<remove name="UrlRoutingHandler" />
|
||||
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
|
||||
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
|
||||
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
</configuration>
|
1
src/Orchard.Specs/Hosting/Orchard.Web/Default.aspx
Normal file
1
src/Orchard.Specs/Hosting/Orchard.Web/Default.aspx
Normal file
@ -0,0 +1 @@
|
||||
<%@ Page AutoEventWireup="true" Inherits="Orchard.Specs.Hosting.Orchard.Web._Default, Orchard.Specs" %>
|
1
src/Orchard.Specs/Hosting/Orchard.Web/Global.asax
Normal file
1
src/Orchard.Specs/Hosting/Orchard.Web/Global.asax
Normal file
@ -0,0 +1 @@
|
||||
<%@ Application Inherits="Orchard.Specs.Hosting.Orchard.Web.MvcApplication, Orchard.Specs" %>
|
45
src/Orchard.Specs/Hosting/Orchard.Web/Global.asax.cs
Normal file
45
src/Orchard.Specs/Hosting/Orchard.Web/Global.asax.cs
Normal file
@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Autofac;
|
||||
using Autofac.Integration.Web;
|
||||
using Orchard.Environment;
|
||||
|
||||
namespace Orchard.Specs.Hosting.Orchard.Web
|
||||
{
|
||||
public class MvcApplication : HttpApplication
|
||||
{
|
||||
private static IOrchardHost _host;
|
||||
|
||||
protected void Application_Start()
|
||||
{
|
||||
_host = OrchardStarter.CreateHost(MvcSingletons);
|
||||
_host.Initialize();
|
||||
|
||||
var route = RouteTable.Routes.MapRoute("foo", "hello-world", new { controller = "Home", action = "Index" });
|
||||
route.RouteHandler = new HelloYetAgainHandler();
|
||||
|
||||
}
|
||||
|
||||
protected void Application_BeginRequest()
|
||||
{
|
||||
_host.BeginRequest();
|
||||
}
|
||||
|
||||
protected void Application_EndRequest()
|
||||
{
|
||||
_host.EndRequest();
|
||||
}
|
||||
|
||||
protected void MvcSingletons(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterInstance(ControllerBuilder.Current);
|
||||
builder.RegisterInstance(RouteTable.Routes);
|
||||
builder.RegisterInstance(ModelBinders.Binders);
|
||||
builder.RegisterInstance(ModelMetadataProviders.Current);
|
||||
builder.RegisterInstance(ViewEngines.Engines);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Web.Routing;
|
||||
|
||||
namespace Orchard.Specs.Hosting.Orchard.Web
|
||||
{
|
||||
public class HelloYetAgainHandler : IRouteHandler, IHttpHandler
|
||||
{
|
||||
public IHttpHandler GetHttpHandler(RequestContext requestContext)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
context.Response.Write("Hello yet again");
|
||||
}
|
||||
|
||||
public bool IsReusable { get { return false; } }
|
||||
}
|
||||
}
|
5
src/Orchard.Specs/Hosting/Orchard.Web/Simple/Page.aspx
Normal file
5
src/Orchard.Specs/Hosting/Orchard.Web/Simple/Page.aspx
Normal file
@ -0,0 +1,5 @@
|
||||
<%@ Page %>
|
||||
|
||||
<p>Hello again</p>
|
||||
<p>RawUrl: <%=Page.Request.RawUrl%></p>
|
||||
<p>Moving along to <a href="/hello-world">next page</a></p>
|
1
src/Orchard.Specs/Hosting/Orchard.Web/Static.txt
Normal file
1
src/Orchard.Specs/Hosting/Orchard.Web/Static.txt
Normal file
@ -0,0 +1 @@
|
||||
Hello world!
|
35
src/Orchard.Specs/Hosting/Orchard.Web/Themes/Web.config
Normal file
35
src/Orchard.Specs/Hosting/Orchard.Web/Themes/Web.config
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<system.web>
|
||||
<httpHandlers>
|
||||
<add path="*.aspx" verb="*" type="System.Web.HttpNotFoundHandler"/>
|
||||
<add path="*.ascx" verb="*" type="System.Web.HttpNotFoundHandler"/>
|
||||
<add path="*.master" verb="*" type="System.Web.HttpNotFoundHandler"/>
|
||||
</httpHandlers>
|
||||
|
||||
<!--
|
||||
Enabling request validation in view pages would cause validation to occur
|
||||
after the input has already been processed by the controller. By default
|
||||
MVC performs request validation before a controller processes the input.
|
||||
To change this behavior apply the ValidateInputAttribute to a
|
||||
controller or action.
|
||||
-->
|
||||
<pages
|
||||
validateRequest="false"
|
||||
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<controls>
|
||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
|
||||
</controls>
|
||||
</pages>
|
||||
</system.web>
|
||||
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
<handlers>
|
||||
<remove name="BlockViewHandler"/>
|
||||
<add name="BlockViewHandler" path="*.aspx,*.ascx,*.master" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
</configuration>
|
212
src/Orchard.Specs/Hosting/Orchard.Web/Web.config
Normal file
212
src/Orchard.Specs/Hosting/Orchard.Web/Web.config
Normal file
@ -0,0 +1,212 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Note: As an alternative to hand editing this file you can use the
|
||||
web admin tool to configure settings for your application. Use
|
||||
the Website->Asp.Net Configuration option in Visual Studio.
|
||||
A full list of settings and comments can be found in
|
||||
machine.config.comments usually located in
|
||||
\Windows\Microsoft.Net\Framework\v2.x\Config
|
||||
-->
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
|
||||
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
</sectionGroup>
|
||||
</sectionGroup>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<appSettings/>
|
||||
|
||||
<!--<system.diagnostics configSource="Config\Diagnostics.config" />-->
|
||||
|
||||
<!--
|
||||
Set default transaction timeout to 30 minutes so that interactive debugging
|
||||
is easier (default timeout is less than one minute)
|
||||
-->
|
||||
<system.transactions>
|
||||
<defaultSettings timeout="00:30:00" />
|
||||
</system.transactions>
|
||||
|
||||
<system.web>
|
||||
|
||||
<!--
|
||||
Set compilation debug="true" to insert debugging
|
||||
symbols into the compiled page. Because this
|
||||
affects performance, set this value to true only
|
||||
during development.
|
||||
-->
|
||||
<compilation debug="true">
|
||||
<assemblies>
|
||||
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
||||
</assemblies>
|
||||
</compilation>
|
||||
|
||||
<!--
|
||||
The <authentication> section enables configuration
|
||||
of the security authentication mode used by
|
||||
ASP.NET to identify an incoming user.
|
||||
-->
|
||||
<authentication mode="Forms">
|
||||
<forms loginUrl="~/Users/Account/AccessDenied" timeout="2880" />
|
||||
</authentication>
|
||||
|
||||
<membership defaultProvider="OrchardMembershipProvider">
|
||||
<providers>
|
||||
<clear/>
|
||||
<!--<add name="AspNetSqlMembershipProvider"
|
||||
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
|
||||
connectionStringName="ApplicationServices"
|
||||
enablePasswordRetrieval="false"
|
||||
enablePasswordReset="true"
|
||||
requiresQuestionAndAnswer="false"
|
||||
requiresUniqueEmail="false"
|
||||
passwordFormat="Hashed"
|
||||
maxInvalidPasswordAttempts="5"
|
||||
minRequiredPasswordLength="6"
|
||||
minRequiredNonalphanumericCharacters="0"
|
||||
passwordAttemptWindow="10"
|
||||
passwordStrengthRegularExpression=""
|
||||
applicationName="/"
|
||||
/>-->
|
||||
<add name="OrchardMembershipProvider" type="Orchard.Security.Providers.OrchardMembershipProvider, Orchard.Framework"
|
||||
applicationName="/" />
|
||||
</providers>
|
||||
</membership>
|
||||
|
||||
<profile>
|
||||
<providers>
|
||||
<clear/>
|
||||
<add name="AspNetSqlProfileProvider"
|
||||
type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
|
||||
connectionStringName="ApplicationServices"
|
||||
applicationName="/"
|
||||
/>
|
||||
</providers>
|
||||
</profile>
|
||||
|
||||
<roleManager enabled="false">
|
||||
<providers>
|
||||
<clear />
|
||||
<add name="OrchardRoleProvider" type="Orchard.Security.Providers.OrchardRoleProvider, Orchard.Framework"/>
|
||||
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</providers>
|
||||
</roleManager>
|
||||
|
||||
<!--
|
||||
The <customErrors> section enables configuration
|
||||
of what to do if/when an unhandled error occurs
|
||||
during the execution of a request. Specifically,
|
||||
it enables developers to configure html error pages
|
||||
to be displayed in place of a error stack trace.
|
||||
-->
|
||||
|
||||
<customErrors mode="Off" />
|
||||
|
||||
<pages>
|
||||
<controls>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</controls>
|
||||
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc"/>
|
||||
<add namespace="System.Web.Mvc.Ajax"/>
|
||||
<add namespace="System.Web.Mvc.Html"/>
|
||||
<add namespace="System.Web.Routing"/>
|
||||
<add namespace="System.Linq"/>
|
||||
<add namespace="System.Collections.Generic"/>
|
||||
<add namespace="Orchard.Mvc.Html" />
|
||||
</namespaces>
|
||||
</pages>
|
||||
|
||||
<httpHandlers>
|
||||
<remove verb="*" path="*.asmx"/>
|
||||
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
|
||||
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</httpHandlers>
|
||||
|
||||
<httpModules>
|
||||
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</httpModules>
|
||||
|
||||
</system.web>
|
||||
|
||||
<system.codedom>
|
||||
<compilers>
|
||||
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
|
||||
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<providerOption name="CompilerVersion" value="v3.5"/>
|
||||
<providerOption name="WarnAsError" value="false"/>
|
||||
</compiler>
|
||||
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4"
|
||||
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<providerOption name="CompilerVersion" value="v3.5"/>
|
||||
<providerOption name="OptionInfer" value="true"/>
|
||||
<providerOption name="WarnAsError" value="false"/>
|
||||
</compiler>
|
||||
</compilers>
|
||||
</system.codedom>
|
||||
|
||||
<system.web.extensions/>
|
||||
|
||||
<!--
|
||||
The system.webServer section is required for running ASP.NET AJAX under Internet
|
||||
Information Services 7.0. It is not necessary for previous version of IIS.
|
||||
-->
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
|
||||
<modules runAllManagedModulesForAllRequests="true">
|
||||
<remove name="ScriptModule" />
|
||||
<remove name="UrlRoutingModule" />
|
||||
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</modules>
|
||||
|
||||
<handlers>
|
||||
<remove name="WebServiceHandlerFactory-Integrated"/>
|
||||
<remove name="ScriptHandlerFactory" />
|
||||
<remove name="ScriptHandlerFactoryAppServices" />
|
||||
<remove name="ScriptResource" />
|
||||
<remove name="MvcHttpHandler" />
|
||||
<remove name="UrlRoutingHandler" />
|
||||
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
|
||||
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
|
||||
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
</configuration>
|
20
src/Orchard.Specs/Hosting/Orchard.Web/_Default.aspx.cs
Normal file
20
src/Orchard.Specs/Hosting/Orchard.Web/_Default.aspx.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.UI;
|
||||
|
||||
namespace Orchard.Specs.Hosting.Orchard.Web {
|
||||
public class _Default : Page {
|
||||
public void Page_Load(object sender, EventArgs e) {
|
||||
// Change the current path so that the Routing handler can correctly interpret
|
||||
// the request, then restore the original path so that the OutputCache module
|
||||
// can correctly process the response (if caching is enabled).
|
||||
|
||||
var originalPath = Request.Path;
|
||||
HttpContext.Current.RewritePath(Request.ApplicationPath, false);
|
||||
IHttpHandler httpHandler = new MvcHttpHandler();
|
||||
httpHandler.ProcessRequest(HttpContext.Current);
|
||||
HttpContext.Current.RewritePath(originalPath, false);
|
||||
}
|
||||
}
|
||||
}
|
18
src/Orchard.Specs/Hosting/RequestDetails.cs
Normal file
18
src/Orchard.Specs/Hosting/RequestDetails.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Orchard.Specs.Hosting
|
||||
{
|
||||
[Serializable]
|
||||
public class RequestDetails
|
||||
{
|
||||
public string Page { get; set; }
|
||||
public string Query { get; set; }
|
||||
|
||||
public int StatusCode { get; set; }
|
||||
public string StatusDescription { get; set; }
|
||||
public string ResponseText { get; set; }
|
||||
}
|
||||
}
|
63
src/Orchard.Specs/Hosting/RequestExtensions.cs
Normal file
63
src/Orchard.Specs/Hosting/RequestExtensions.cs
Normal file
@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Hosting;
|
||||
using Orchard.Specs.Util;
|
||||
|
||||
namespace Orchard.Specs.Hosting
|
||||
{
|
||||
public static class RequestExtensions
|
||||
{
|
||||
public static RequestDetails SendRequest(this WebHost webHost, string urlPath)
|
||||
{
|
||||
var physicalPath = new PathUtil(webHost.PhysicalDirectory);
|
||||
|
||||
var details = new RequestDetails
|
||||
{
|
||||
Page = physicalPath
|
||||
.Combine(urlPath.TrimStart('/', '\\'))
|
||||
.GetRelativePath(physicalPath)
|
||||
.ToString()
|
||||
};
|
||||
|
||||
webHost.Execute(() =>
|
||||
{
|
||||
var output = new StringWriter();
|
||||
var worker = new Worker(details, output);
|
||||
HttpRuntime.ProcessRequest(worker);
|
||||
details.ResponseText = output.ToString();
|
||||
});
|
||||
|
||||
return details;
|
||||
}
|
||||
|
||||
class Worker : SimpleWorkerRequest
|
||||
{
|
||||
private RequestDetails _details;
|
||||
private TextWriter _output;
|
||||
|
||||
public Worker(RequestDetails details, TextWriter output)
|
||||
: base(details.Page, details.Query, output)
|
||||
{
|
||||
_details = details;
|
||||
_output = output;
|
||||
}
|
||||
|
||||
public override void SendStatus(int statusCode, string statusDescription)
|
||||
{
|
||||
_details.StatusCode = statusCode;
|
||||
_details.StatusDescription = statusDescription;
|
||||
|
||||
base.SendStatus(statusCode, statusDescription);
|
||||
}
|
||||
|
||||
public override void SendResponseFromFile(string filename, long offset, long length)
|
||||
{
|
||||
_output.Write(File.ReadAllText(filename));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
99
src/Orchard.Specs/Hosting/SerializableDelegate.cs
Normal file
99
src/Orchard.Specs/Hosting/SerializableDelegate.cs
Normal file
@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Orchard.Specs.Hosting {
|
||||
/// <summary>
|
||||
/// Makes delegates serializable where possible
|
||||
/// Adapted from http://www.codeproject.com/KB/cs/AnonymousSerialization.aspx
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SerializableDelegate<TDelegate> : ISerializable where TDelegate : class
|
||||
{
|
||||
public TDelegate Delegate { get; private set; }
|
||||
|
||||
public SerializableDelegate(TDelegate @delegate)
|
||||
{
|
||||
Delegate = @delegate;
|
||||
}
|
||||
|
||||
internal SerializableDelegate(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
var delegateType = (Type) info.GetValue("delegateType", typeof (Type));
|
||||
|
||||
if (info.GetBoolean("isSerializable"))
|
||||
//If it's a "simple" delegate we just read it straight off
|
||||
Delegate = (TDelegate) info.GetValue("delegate", delegateType);
|
||||
else {
|
||||
//otherwise, we need to read its anonymous class
|
||||
var methodInfo = (MethodInfo) info.GetValue("method", typeof (MethodInfo));
|
||||
var anonymousClassWrapper = (AnonymousClassWrapper) info.GetValue("class", typeof (AnonymousClassWrapper));
|
||||
Delegate = (TDelegate)(object)System.Delegate.CreateDelegate(delegateType, anonymousClassWrapper.TargetInstance, methodInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
info.AddValue("delegateType", Delegate.GetType());
|
||||
var untypedDelegate = (Delegate) (object) Delegate;
|
||||
//If it's an "simple" delegate we can serialize it directly
|
||||
if ((untypedDelegate.Target == null || untypedDelegate.Method.DeclaringType.GetCustomAttributes(typeof(SerializableAttribute), false).Length > 0) && Delegate != null)
|
||||
{
|
||||
info.AddValue("isSerializable", true);
|
||||
info.AddValue("delegate", Delegate);
|
||||
}
|
||||
else {
|
||||
//otherwise, serialize anonymous class
|
||||
info.AddValue("isSerializable", false);
|
||||
info.AddValue("method", untypedDelegate.Method);
|
||||
info.AddValue("class", new AnonymousClassWrapper(untypedDelegate.Method.DeclaringType, untypedDelegate.Target));
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
private class AnonymousClassWrapper : ISerializable
|
||||
{
|
||||
public object TargetInstance { get; private set; }
|
||||
private readonly Type targetType;
|
||||
|
||||
internal AnonymousClassWrapper(Type targetType, object targetInstance)
|
||||
{
|
||||
this.targetType = targetType;
|
||||
TargetInstance = targetInstance;
|
||||
}
|
||||
|
||||
internal AnonymousClassWrapper(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
var classType = (Type) info.GetValue("classType", typeof (Type));
|
||||
TargetInstance = Activator.CreateInstance(classType);
|
||||
|
||||
foreach (FieldInfo field in classType.GetFields()) {
|
||||
if (typeof (Delegate).IsAssignableFrom(field.FieldType))
|
||||
//If the field is a delegate
|
||||
field.SetValue(TargetInstance, ((SerializableDelegate<TDelegate>)info.GetValue(field.Name, typeof(SerializableDelegate<TDelegate>))).Delegate);
|
||||
else if (!field.FieldType.IsSerializable)
|
||||
//If the field is an anonymous class
|
||||
field.SetValue(TargetInstance, ((AnonymousClassWrapper) info.GetValue(field.Name, typeof (AnonymousClassWrapper))).TargetInstance);
|
||||
else
|
||||
//otherwise
|
||||
field.SetValue(TargetInstance, info.GetValue(field.Name, field.FieldType));
|
||||
}
|
||||
}
|
||||
|
||||
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
info.AddValue("classType", targetType);
|
||||
|
||||
foreach (FieldInfo field in targetType.GetFields()) {
|
||||
//See corresponding comments above
|
||||
if (typeof (Delegate).IsAssignableFrom(field.FieldType))
|
||||
info.AddValue(field.Name, new SerializableDelegate<TDelegate>((TDelegate)field.GetValue(TargetInstance)));
|
||||
else if (!field.FieldType.IsSerializable)
|
||||
info.AddValue(field.Name, new AnonymousClassWrapper(field.FieldType, field.GetValue(TargetInstance)));
|
||||
else
|
||||
info.AddValue(field.Name, field.GetValue(TargetInstance));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
69
src/Orchard.Specs/Hosting/WebHost.cs
Normal file
69
src/Orchard.Specs/Hosting/WebHost.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Web.Hosting;
|
||||
using Orchard.Specs.Util;
|
||||
|
||||
namespace Orchard.Specs.Hosting
|
||||
{
|
||||
public class WebHost
|
||||
{
|
||||
private WebHostAgent _webHostAgent;
|
||||
private PathUtil _tempSite;
|
||||
private PathUtil _orchardWebPath;
|
||||
|
||||
public void Initialize(string templateName, string virtualDirectory)
|
||||
{
|
||||
_tempSite = PathUtil.GetTempFolder();
|
||||
_orchardWebPath = PathUtil.BaseDirectory.Parent.Parent.Parent.Combine("Orchard.Web");
|
||||
|
||||
var baseDir = PathUtil.BaseDirectory;
|
||||
|
||||
PathUtil.BaseDirectory
|
||||
.Combine("Hosting")
|
||||
.Combine(templateName)
|
||||
.CopyAll(SearchOption.AllDirectories, _tempSite);
|
||||
|
||||
_orchardWebPath.Combine("bin").CopyAll("*.dll", _tempSite.Combine("bin"));
|
||||
_orchardWebPath.Combine("bin").CopyAll("*.pdb", _tempSite.Combine("bin"));
|
||||
baseDir.CopyAll("*.dll", _tempSite.Combine("bin"));
|
||||
baseDir.CopyAll("*.pdb", _tempSite.Combine("bin"));
|
||||
|
||||
PhysicalDirectory = _tempSite.ToString();
|
||||
VirtualDirectory = virtualDirectory;
|
||||
|
||||
_webHostAgent = (WebHostAgent)ApplicationHost.CreateApplicationHost(typeof(WebHostAgent), VirtualDirectory, PhysicalDirectory);
|
||||
}
|
||||
|
||||
public void CopyExtension(string extensionFolder, string extensionName) {
|
||||
var sourceModule = _orchardWebPath.Combine(extensionFolder).Combine(extensionName);
|
||||
var targetModule = _tempSite.Combine(extensionFolder).Combine(extensionName);
|
||||
sourceModule.CopyAll("*.txt", targetModule);
|
||||
if (sourceModule.Combine("Views").DirectoryExists)
|
||||
sourceModule.Combine("Views").CopyAll(SearchOption.AllDirectories, targetModule.Combine("Views"));
|
||||
|
||||
}
|
||||
|
||||
public string PhysicalDirectory { get; private set; }
|
||||
public string VirtualDirectory { get; private set; }
|
||||
|
||||
public void Execute(Action action)
|
||||
{
|
||||
var shuttleSend = new SerializableDelegate<Action>(action);
|
||||
var shuttleRecv = _webHostAgent.Execute(shuttleSend);
|
||||
CopyFields(shuttleRecv.Delegate.Target, shuttleSend.Delegate.Target);
|
||||
}
|
||||
|
||||
private static void CopyFields<T>(T from, T to) where T : class
|
||||
{
|
||||
if (from == null || to == null)
|
||||
return;
|
||||
foreach (FieldInfo fieldInfo in from.GetType().GetFields())
|
||||
{
|
||||
var value = fieldInfo.GetValue(from);
|
||||
fieldInfo.SetValue(to, value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
12
src/Orchard.Specs/Hosting/WebHostAgent.cs
Normal file
12
src/Orchard.Specs/Hosting/WebHostAgent.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Orchard.Specs.Hosting {
|
||||
public class WebHostAgent : MarshalByRefObject
|
||||
{
|
||||
public SerializableDelegate<Action> Execute(SerializableDelegate<Action> shuttle)
|
||||
{
|
||||
shuttle.Delegate();
|
||||
return shuttle;
|
||||
}
|
||||
}
|
||||
}
|
@ -31,14 +31,43 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=2.1.13.813, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\autofac\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Web, Version=2.1.13.813, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\autofac\Autofac.Integration.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Web.Mvc, Version=2.1.13.813, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\autofac\Autofac.Integration.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HtmlAgilityPack, Version=1.3.9.1, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\htmlagilitypack\HtmlAgilityPack.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.VisualStudio.TeamSystem.Data.UnitTesting, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="nunit.framework, Version=2.5.2.9222, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\nunit\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
@ -53,20 +82,89 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Hosting\Orchard.Web\HelloYetAgainHandler.cs" />
|
||||
<Compile Include="Hosting\RequestExtensions.cs" />
|
||||
<Compile Include="Hosting\RequestDetails.cs" />
|
||||
<Compile Include="WebHosting.feature.cs">
|
||||
<DependentUpon>WebHosting.feature</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Hosting\Orchard.Web\Global.asax.cs" />
|
||||
<Compile Include="Hosting\SerializableDelegate.cs" />
|
||||
<Compile Include="Bindings\WebAppHosting.cs" />
|
||||
<Compile Include="Hosting\WebHost.cs" />
|
||||
<Compile Include="Hosting\WebHostAgent.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Setup.feature.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Setup.feature</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UsingSpecFlow.feature.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>UsingSpecFlow.feature</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Bindings\SanityCheck.cs" />
|
||||
<Compile Include="Hosting\Orchard.Web\_Default.aspx.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Util\PathUtil.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Hosting\Orchard.Web\Web.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Hosting\Orchard.Web\Core\Web.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Hosting\Orchard.Web\Themes\Web.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="WebHosting.feature">
|
||||
<Generator>SpecFlowSingleFileGenerator</Generator>
|
||||
<LastGenOutput>WebHosting.feature.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Setup.feature">
|
||||
<Generator>SpecFlowSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Setup.feature.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="UsingSpecFlow.feature">
|
||||
<Generator>SpecFlowSingleFileGenerator</Generator>
|
||||
<LastGenOutput>UsingSpecFlow.feature.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Orchard.Web\Modules\Orchard.Setup\Orchard.Setup.csproj">
|
||||
<Project>{8C7FCBC2-E6E1-405E-BFB5-D8D9E67A09C4}</Project>
|
||||
<Name>Orchard.Setup</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard\Orchard.Framework.csproj">
|
||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||
<Name>Orchard.Framework</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Service References\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Hosting\Orchard.Web\Content\Static.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Hosting\Orchard.Web\Default.aspx">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Hosting\Orchard.Web\Global.asax">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Hosting\Orchard.Web\Simple\Page.aspx">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Hosting\Orchard.Web\Static.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
22
src/Orchard.Specs/Setup.feature
Normal file
22
src/Orchard.Specs/Setup.feature
Normal file
@ -0,0 +1,22 @@
|
||||
Feature: Setup
|
||||
In order to install orchard
|
||||
As a new user
|
||||
I want to setup a new site from the default screen
|
||||
|
||||
Scenario: Root request shows setup form
|
||||
Given I have a clean site
|
||||
And I have module "Orchard.Setup"
|
||||
And I have theme "SafeMode"
|
||||
When I go to "/Default.aspx"
|
||||
Then I should see "Welcome to Orchard"
|
||||
And I should see "Finish Setup"
|
||||
And the status should be 200 OK
|
||||
|
||||
Scenario: Setup folder also shows setup form
|
||||
Given I have a clean site
|
||||
And I have module "Orchard.Setup"
|
||||
And I have theme "SafeMode"
|
||||
When I go to "/Setup"
|
||||
Then I should see "Welcome to Orchard"
|
||||
And I should see "Finish Setup"
|
||||
And the status should be 200 OK
|
103
src/Orchard.Specs/Setup.feature.cs
generated
Normal file
103
src/Orchard.Specs/Setup.feature.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by SpecFlow (http://www.specflow.org/).
|
||||
// SpecFlow Version:1.2.0.0
|
||||
// Runtime Version:2.0.50727.4200
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
// ------------------------------------------------------------------------------
|
||||
namespace Orchard.Specs
|
||||
{
|
||||
using TechTalk.SpecFlow;
|
||||
|
||||
|
||||
[NUnit.Framework.TestFixtureAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Setup")]
|
||||
public partial class SetupFeature
|
||||
{
|
||||
|
||||
private static TechTalk.SpecFlow.ITestRunner testRunner;
|
||||
|
||||
#line 1 "Setup.feature"
|
||||
#line hidden
|
||||
|
||||
[NUnit.Framework.TestFixtureSetUpAttribute()]
|
||||
public virtual void FeatureSetup()
|
||||
{
|
||||
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
|
||||
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Setup", "In order to install orchard\r\nAs a new user\r\nI want to setup a new site from the d" +
|
||||
"efault screen", ((string[])(null)));
|
||||
testRunner.OnFeatureStart(featureInfo);
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestFixtureTearDownAttribute()]
|
||||
public virtual void FeatureTearDown()
|
||||
{
|
||||
testRunner.OnFeatureEnd();
|
||||
testRunner = null;
|
||||
}
|
||||
|
||||
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
|
||||
{
|
||||
testRunner.OnScenarioStart(scenarioInfo);
|
||||
}
|
||||
|
||||
[NUnit.Framework.TearDownAttribute()]
|
||||
public virtual void ScenarioTearDown()
|
||||
{
|
||||
testRunner.OnScenarioEnd();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Root request shows setup form")]
|
||||
public virtual void RootRequestShowsSetupForm()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Root request shows setup form", ((string[])(null)));
|
||||
#line 6
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 7
|
||||
testRunner.Given("I have a clean site");
|
||||
#line 8
|
||||
testRunner.And("I have module \"Orchard.Setup\"");
|
||||
#line 9
|
||||
testRunner.And("I have theme \"SafeMode\"");
|
||||
#line 10
|
||||
testRunner.When("I go to \"/Default.aspx\"");
|
||||
#line 11
|
||||
testRunner.Then("I should see \"Welcome to Orchard\"");
|
||||
#line 12
|
||||
testRunner.And("I should see \"Finish Setup\"");
|
||||
#line 13
|
||||
testRunner.And("the status should be 200 OK");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Setup folder also shows setup form")]
|
||||
public virtual void SetupFolderAlsoShowsSetupForm()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Setup folder also shows setup form", ((string[])(null)));
|
||||
#line 15
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 16
|
||||
testRunner.Given("I have a clean site");
|
||||
#line 17
|
||||
testRunner.And("I have module \"Orchard.Setup\"");
|
||||
#line 18
|
||||
testRunner.And("I have theme \"SafeMode\"");
|
||||
#line 19
|
||||
testRunner.When("I go to \"/Setup\"");
|
||||
#line 20
|
||||
testRunner.Then("I should see \"Welcome to Orchard\"");
|
||||
#line 21
|
||||
testRunner.And("I should see \"Finish Setup\"");
|
||||
#line 22
|
||||
testRunner.And("the status should be 200 OK");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
}
|
||||
}
|
117
src/Orchard.Specs/Util/PathUtil.cs
Normal file
117
src/Orchard.Specs/Util/PathUtil.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Orchard.Specs.Util {
|
||||
public class PathUtil {
|
||||
private readonly string _path;
|
||||
|
||||
public PathUtil(string path) {
|
||||
_path = path;
|
||||
}
|
||||
|
||||
public static PathUtil GetTempFile() {
|
||||
return new PathUtil(Path.GetTempFileName());
|
||||
}
|
||||
|
||||
public static PathUtil GetTempFolder() {
|
||||
var path = GetTempFile().DeleteFile().CreateDirectory();
|
||||
return path;
|
||||
}
|
||||
|
||||
public static PathUtil BaseDirectory {
|
||||
get { return new PathUtil(AppDomain.CurrentDomain.BaseDirectory); }
|
||||
}
|
||||
|
||||
public PathUtil FullPath {
|
||||
get { return new PathUtil(Path.GetFullPath(_path)); }
|
||||
}
|
||||
|
||||
public PathUtil CreateDirectory() {
|
||||
Directory.CreateDirectory(_path);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PathUtil DeleteFile() {
|
||||
File.Delete(_path);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PathUtil Combine(PathUtil path) {
|
||||
return Combine(path.ToString());
|
||||
}
|
||||
public PathUtil Combine(string path) {
|
||||
return new PathUtil(Path.Combine(_path, path));
|
||||
}
|
||||
|
||||
public IEnumerable<PathUtil> GetFiles(string pattern) {
|
||||
return GetFiles(pattern, SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
|
||||
public IEnumerable<PathUtil> GetFiles(SearchOption searchOptions) {
|
||||
return GetFiles("*", searchOptions);
|
||||
}
|
||||
|
||||
public IEnumerable<PathUtil> GetFiles(string pattern, SearchOption searchOptions) {
|
||||
return Directory.GetFiles(_path, pattern, searchOptions).Select(sz => new PathUtil(sz));
|
||||
}
|
||||
|
||||
public void CopyAll(string pattern, PathUtil target) {
|
||||
CopyAll(pattern, SearchOption.TopDirectoryOnly, target);
|
||||
}
|
||||
|
||||
public void CopyAll(SearchOption searchOptions, PathUtil target) {
|
||||
CopyAll("*", searchOptions, target);
|
||||
}
|
||||
|
||||
public void CopyAll(string pattern, SearchOption searchOptions, PathUtil target) {
|
||||
foreach (var file in GetFiles(pattern, searchOptions)) {
|
||||
var targetFile = target.Combine(file.GetRelativePath(this));
|
||||
targetFile.Parent.CreateDirectory();
|
||||
file.Copy(targetFile);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode() {
|
||||
return (_path ?? string.Empty).GetHashCode();
|
||||
}
|
||||
public override bool Equals(object obj) {
|
||||
if (obj == null || obj.GetType() != GetType())
|
||||
return false;
|
||||
return ((PathUtil)obj)._path == _path;
|
||||
}
|
||||
public override string ToString() {
|
||||
return _path;
|
||||
}
|
||||
|
||||
public PathUtil GetRelativePath(PathUtil basePath) {
|
||||
if (this.Equals(basePath))
|
||||
return new PathUtil(".");
|
||||
|
||||
if (Parent.Equals(basePath))
|
||||
return FileName;
|
||||
|
||||
return Parent.GetRelativePath(basePath).Combine(FileName);
|
||||
}
|
||||
|
||||
|
||||
public PathUtil Copy(PathUtil target) {
|
||||
File.Copy(_path, target._path, true);
|
||||
return target;
|
||||
}
|
||||
|
||||
public PathUtil Parent {
|
||||
get { return new PathUtil(Path.GetDirectoryName(_path)); }
|
||||
}
|
||||
|
||||
public PathUtil FileName {
|
||||
get { return new PathUtil(Path.GetFileName(_path)); }
|
||||
}
|
||||
|
||||
public bool DirectoryExists {
|
||||
get { return Directory.Exists(_path); }
|
||||
}
|
||||
}
|
||||
}
|
53
src/Orchard.Specs/WebHosting.feature
Normal file
53
src/Orchard.Specs/WebHosting.feature
Normal file
@ -0,0 +1,53 @@
|
||||
Feature: Web Hosting
|
||||
In order to test orchard
|
||||
As an integration runner
|
||||
I want to verify basic hosting is working
|
||||
|
||||
Scenario: Returning static files
|
||||
Given I have a clean site
|
||||
When I go to "Content/Static.txt"
|
||||
Then the status should be 200 OK
|
||||
And I should see "Hello world!"
|
||||
|
||||
Scenario: Returning static files 2
|
||||
Given I have a clean site
|
||||
When I go to "Content\Static.txt"
|
||||
Then the status should be 200 OK
|
||||
And I should see "Hello world!"
|
||||
|
||||
Scenario: Returning static files 3
|
||||
Given I have a clean site
|
||||
When I go to "/Static.txt"
|
||||
Then the status should be 200 OK
|
||||
And I should see "Hello world!"
|
||||
|
||||
Scenario: Returning static files 4
|
||||
Given I have a clean site
|
||||
When I go to "Static.txt"
|
||||
Then the status should be 200 OK
|
||||
And I should see "Hello world!"
|
||||
|
||||
Scenario: Returning web forms page
|
||||
Given I have a clean site
|
||||
When I go to "Simple/Page.aspx"
|
||||
Then the status should be 200 OK
|
||||
And I should see "Hello again"
|
||||
|
||||
Scenario: Returning web forms page 2
|
||||
Given I have a clean site
|
||||
When I go to "Simple\Page.aspx"
|
||||
Then the status should be 200 OK
|
||||
And I should see "Hello again"
|
||||
|
||||
Scenario: Returning a routed request
|
||||
Given I have a clean site
|
||||
When I go to "hello-world"
|
||||
Then the status should be 200 OK
|
||||
And I should see "Hello yet again"
|
||||
|
||||
Scenario: Following a link
|
||||
Given I have a clean site
|
||||
When I go to "/simple/page.aspx"
|
||||
And I follow "next page"
|
||||
Then the status should be 200 OK
|
||||
And I should see "Hello yet again"
|
207
src/Orchard.Specs/WebHosting.feature.cs
generated
Normal file
207
src/Orchard.Specs/WebHosting.feature.cs
generated
Normal file
@ -0,0 +1,207 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by SpecFlow (http://www.specflow.org/).
|
||||
// SpecFlow Version:1.2.0.0
|
||||
// Runtime Version:2.0.50727.4200
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
// ------------------------------------------------------------------------------
|
||||
namespace Orchard.Specs
|
||||
{
|
||||
using TechTalk.SpecFlow;
|
||||
|
||||
|
||||
[NUnit.Framework.TestFixtureAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Web Hosting")]
|
||||
public partial class WebHostingFeature
|
||||
{
|
||||
|
||||
private static TechTalk.SpecFlow.ITestRunner testRunner;
|
||||
|
||||
#line 1 "WebHosting.feature"
|
||||
#line hidden
|
||||
|
||||
[NUnit.Framework.TestFixtureSetUpAttribute()]
|
||||
public virtual void FeatureSetup()
|
||||
{
|
||||
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
|
||||
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Web Hosting", "In order to test orchard\r\nAs an integration runner\r\nI want to verify basic hostin" +
|
||||
"g is working", ((string[])(null)));
|
||||
testRunner.OnFeatureStart(featureInfo);
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestFixtureTearDownAttribute()]
|
||||
public virtual void FeatureTearDown()
|
||||
{
|
||||
testRunner.OnFeatureEnd();
|
||||
testRunner = null;
|
||||
}
|
||||
|
||||
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
|
||||
{
|
||||
testRunner.OnScenarioStart(scenarioInfo);
|
||||
}
|
||||
|
||||
[NUnit.Framework.TearDownAttribute()]
|
||||
public virtual void ScenarioTearDown()
|
||||
{
|
||||
testRunner.OnScenarioEnd();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Returning static files")]
|
||||
public virtual void ReturningStaticFiles()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Returning static files", ((string[])(null)));
|
||||
#line 6
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 7
|
||||
testRunner.Given("I have a clean site");
|
||||
#line 8
|
||||
testRunner.When("I go to \"Content/Static.txt\"");
|
||||
#line 9
|
||||
testRunner.Then("the status should be 200 OK");
|
||||
#line 10
|
||||
testRunner.And("I should see \"Hello world!\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Returning static files 2")]
|
||||
public virtual void ReturningStaticFiles2()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Returning static files 2", ((string[])(null)));
|
||||
#line 12
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 13
|
||||
testRunner.Given("I have a clean site");
|
||||
#line 14
|
||||
testRunner.When("I go to \"Content\\Static.txt\"");
|
||||
#line 15
|
||||
testRunner.Then("the status should be 200 OK");
|
||||
#line 16
|
||||
testRunner.And("I should see \"Hello world!\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Returning static files 3")]
|
||||
public virtual void ReturningStaticFiles3()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Returning static files 3", ((string[])(null)));
|
||||
#line 18
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 19
|
||||
testRunner.Given("I have a clean site");
|
||||
#line 20
|
||||
testRunner.When("I go to \"/Static.txt\"");
|
||||
#line 21
|
||||
testRunner.Then("the status should be 200 OK");
|
||||
#line 22
|
||||
testRunner.And("I should see \"Hello world!\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Returning static files 4")]
|
||||
public virtual void ReturningStaticFiles4()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Returning static files 4", ((string[])(null)));
|
||||
#line 24
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 25
|
||||
testRunner.Given("I have a clean site");
|
||||
#line 26
|
||||
testRunner.When("I go to \"Static.txt\"");
|
||||
#line 27
|
||||
testRunner.Then("the status should be 200 OK");
|
||||
#line 28
|
||||
testRunner.And("I should see \"Hello world!\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Returning web forms page")]
|
||||
public virtual void ReturningWebFormsPage()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Returning web forms page", ((string[])(null)));
|
||||
#line 30
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 31
|
||||
testRunner.Given("I have a clean site");
|
||||
#line 32
|
||||
testRunner.When("I go to \"Simple/Page.aspx\"");
|
||||
#line 33
|
||||
testRunner.Then("the status should be 200 OK");
|
||||
#line 34
|
||||
testRunner.And("I should see \"Hello again\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Returning web forms page 2")]
|
||||
public virtual void ReturningWebFormsPage2()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Returning web forms page 2", ((string[])(null)));
|
||||
#line 36
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 37
|
||||
testRunner.Given("I have a clean site");
|
||||
#line 38
|
||||
testRunner.When("I go to \"Simple\\Page.aspx\"");
|
||||
#line 39
|
||||
testRunner.Then("the status should be 200 OK");
|
||||
#line 40
|
||||
testRunner.And("I should see \"Hello again\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Returning a routed request")]
|
||||
public virtual void ReturningARoutedRequest()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Returning a routed request", ((string[])(null)));
|
||||
#line 42
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 43
|
||||
testRunner.Given("I have a clean site");
|
||||
#line 44
|
||||
testRunner.When("I go to \"hello-world\"");
|
||||
#line 45
|
||||
testRunner.Then("the status should be 200 OK");
|
||||
#line 46
|
||||
testRunner.And("I should see \"Hello yet again\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Following a link")]
|
||||
public virtual void FollowingALink()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Following a link", ((string[])(null)));
|
||||
#line 48
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 49
|
||||
testRunner.Given("I have a clean site");
|
||||
#line 50
|
||||
testRunner.When("I go to \"/simple/page.aspx\"");
|
||||
#line 51
|
||||
testRunner.And("I follow \"next page\"");
|
||||
#line 52
|
||||
testRunner.Then("the status should be 200 OK");
|
||||
#line 53
|
||||
testRunner.And("I should see \"Hello yet again\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
}
|
||||
}
|
@ -19,24 +19,24 @@ namespace Orchard.Tests.Modules.Setup {
|
||||
|
||||
[SetUp]
|
||||
public void Init() {
|
||||
_tempFolder = Path.GetTempFileName();
|
||||
File.Delete(_tempFolder);
|
||||
Directory.CreateDirectory(_tempFolder);
|
||||
//_tempFolder = Path.GetTempFileName();
|
||||
//File.Delete(_tempFolder);
|
||||
//Directory.CreateDirectory(_tempFolder);
|
||||
|
||||
var hostContainer = OrchardStarter.CreateHostContainer(builder => {
|
||||
builder.RegisterInstance(new ControllerBuilder());
|
||||
builder.RegisterInstance(new ViewEngineCollection { new WebFormViewEngine() });
|
||||
builder.RegisterInstance(new RouteCollection());
|
||||
builder.RegisterInstance(new ModelBinderDictionary());
|
||||
});
|
||||
//var hostContainer = OrchardStarter.CreateHostContainer(builder => {
|
||||
// builder.RegisterInstance(new ControllerBuilder());
|
||||
// builder.RegisterInstance(new ViewEngineCollection { new WebFormViewEngine() });
|
||||
// builder.RegisterInstance(new RouteCollection());
|
||||
// builder.RegisterInstance(new ModelBinderDictionary());
|
||||
//});
|
||||
|
||||
hostContainer.Resolve<IAppDataFolder>().SetBasePath(_tempFolder);
|
||||
//hostContainer.Resolve<IAppDataFolder>().SetBasePath(_tempFolder);
|
||||
|
||||
var host = (DefaultOrchardHost)hostContainer.Resolve<IOrchardHost>();
|
||||
_container = host.CreateShellContainer().BeginLifetimeScope();
|
||||
var updater = new ContainerUpdater();
|
||||
updater.RegisterType<SetupController>();
|
||||
updater.Update(_container);
|
||||
//var host = (DefaultOrchardHost)hostContainer.Resolve<IOrchardHost>();
|
||||
//_container = host.CreateShellContainer().BeginLifetimeScope();
|
||||
//var updater = new ContainerUpdater();
|
||||
//updater.RegisterType<SetupController>();
|
||||
//updater.Update(_container);
|
||||
|
||||
//var builder = new ContainerBuilder();
|
||||
//builder.Register<SetupController>();
|
||||
|
Loading…
Reference in New Issue
Block a user