Adding SpecFlow test for dynamic compilation

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-11-23 14:08:29 -08:00
parent a86db32577
commit fa5971aa6f
4 changed files with 102 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ namespace Orchard.Specs.Bindings {
private HtmlDocument _doc; private HtmlDocument _doc;
private MessageSink _messages; private MessageSink _messages;
private static readonly Path _orchardTemp = Path.Get(System.IO.Path.GetTempPath()).Combine("Orchard.Specs"); private static readonly Path _orchardTemp = Path.Get(System.IO.Path.GetTempPath()).Combine("Orchard.Specs");
private ExtensionDeploymentOptions _moduleDeploymentOptions = ExtensionDeploymentOptions.CompiledAssembly;
public WebHost Host { public WebHost Host {
get { return _webHost; } get { return _webHost; }
@@ -63,6 +64,10 @@ namespace Orchard.Specs.Bindings {
GivenIHaveACleanSiteBasedOn("Orchard.Web"); GivenIHaveACleanSiteBasedOn("Orchard.Web");
} }
[Given(@"I have chosen to deploy modules as source files only")]
public void GivenIHaveChosenToDeployModulesAsSourceFilesOnly() {
_moduleDeploymentOptions = ExtensionDeploymentOptions.SourceCode;
}
[Given(@"I have a clean site based on (.*)")] [Given(@"I have a clean site based on (.*)")]
public void GivenIHaveACleanSiteBasedOn(string siteFolder) { public void GivenIHaveACleanSiteBasedOn(string siteFolder) {
@@ -105,7 +110,7 @@ namespace Orchard.Specs.Bindings {
[Given(@"I have module ""(.*)""")] [Given(@"I have module ""(.*)""")]
public void GivenIHaveModule(string moduleName) { public void GivenIHaveModule(string moduleName) {
Host.CopyExtension("Modules", moduleName, ExtensionDeploymentOptions.CompiledAssembly); Host.CopyExtension("Modules", moduleName, _moduleDeploymentOptions);
} }
[Given(@"I have theme ""(.*)""")] [Given(@"I have theme ""(.*)""")]

View File

@@ -142,6 +142,12 @@
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
</Compile> </Compile>
<Compile Include="Hosting\ExtensionDeploymentOptions.cs" />
<Compile Include="SiteCompilation.feature.cs">
<DependentUpon>SiteCompilation.feature</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Hosting\MessageSink.cs" /> <Compile Include="Hosting\MessageSink.cs" />
<Compile Include="Hosting\HostingTraceListener.cs" /> <Compile Include="Hosting\HostingTraceListener.cs" />
<Compile Include="Hosting\TraceEnabledDataServicesProviderFactory.cs" /> <Compile Include="Hosting\TraceEnabledDataServicesProviderFactory.cs" />
@@ -222,6 +228,10 @@
<Generator>SpecFlowSingleFileGenerator</Generator> <Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>ContentRights.feature.cs</LastGenOutput> <LastGenOutput>ContentRights.feature.cs</LastGenOutput>
</None> </None>
<None Include="SiteCompilation.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>SiteCompilation.feature.cs</LastGenOutput>
</None>
<None Include="Hosting\Orchard.Web\Config\Diagnostics.config"> <None Include="Hosting\Orchard.Web\Config\Diagnostics.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>

View File

@@ -0,0 +1,10 @@
Feature: The compilation of modules installed in a site
In order to install on Orchard site
As a privileged user
I want to have the modules compiled/installed properly
Scenario: Dynamic compilation support: modules can be deployed as source files only
Given I have chosen to deploy modules as source files only
And I have installed Orchard
When I go to "admin"
Then I should see "<div id="orchard-version">Orchard v(?:\.\d+){2,4}</div>"

View File

@@ -0,0 +1,76 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.3.2.0
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#region Designer generated code
namespace Orchard.Specs
{
using TechTalk.SpecFlow;
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.3.2.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("The compilation of modules installed in a site")]
public partial class TheCompilationOfModulesInstalledInASiteFeature
{
private static TechTalk.SpecFlow.ITestRunner testRunner;
#line 1 "SiteCompilation.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"), "The compilation of modules installed in a site", "In order to install on Orchard site\r\nAs a privileged user\r\nI want to have the mod" +
"ules compiled/installed properly", ((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("Dynamic compilation support: modules can be deployed as source files only")]
public virtual void DynamicCompilationSupportModulesCanBeDeployedAsSourceFilesOnly()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Dynamic compilation support: modules can be deployed as source files only", ((string[])(null)));
#line 6
this.ScenarioSetup(scenarioInfo);
#line 7
testRunner.Given("I have chosen to deploy modules as source files only");
#line 8
testRunner.And("I have installed Orchard");
#line 9
testRunner.When("I go to \"admin\"");
#line 10
testRunner.Then("I should see \"<div id=\"orchard-version\">Orchard v(?:\\.\\d+){2,4}</div>\"");
#line hidden
testRunner.CollectScenarioErrors();
}
}
}
#endregion