mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-31 19:06:34 +08:00
Addind a functional test for international characters in routes
--HG-- branch : 1.x
This commit is contained in:
parent
1983104be2
commit
110cd38033
14
src/Orchard.Specs/Autoroute.feature
Normal file
14
src/Orchard.Specs/Autoroute.feature
Normal file
@ -0,0 +1,14 @@
|
||||
Feature: Autoroutes
|
||||
In order to add content to my site
|
||||
As an author
|
||||
I want to create, publish and edit routes
|
||||
|
||||
Scenario: I can create and publish a new Page with international characters in its route
|
||||
Given I have installed Orchard
|
||||
When I go to "admin/contents/create/page"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Title.Title | Χελλο |
|
||||
And I hit "Publish Now"
|
||||
And I go to "Χελλο"
|
||||
Then I should see "<h1[^>]*>.*?Χελλο.*?</h1>"
|
100
src/Orchard.Specs/Autoroute.feature.cs
generated
Normal file
100
src/Orchard.Specs/Autoroute.feature.cs
generated
Normal file
@ -0,0 +1,100 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by SpecFlow (http://www.specflow.org/).
|
||||
// SpecFlow Version:1.8.1.0
|
||||
// SpecFlow Generator Version:1.8.0.0
|
||||
// Runtime Version:4.0.30319.239
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
// ------------------------------------------------------------------------------
|
||||
#region Designer generated code
|
||||
#pragma warning disable
|
||||
namespace Orchard.Specs
|
||||
{
|
||||
using TechTalk.SpecFlow;
|
||||
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.8.1.0")]
|
||||
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[NUnit.Framework.TestFixtureAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Autoroutes")]
|
||||
public partial class AutoroutesFeature
|
||||
{
|
||||
|
||||
private static TechTalk.SpecFlow.ITestRunner testRunner;
|
||||
|
||||
#line 1 "Autoroute.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"), "Autoroutes", " In order to add content to my site\r\n As an author\r\n I want to create, publish" +
|
||||
" and edit routes", ProgrammingLanguage.CSharp, ((string[])(null)));
|
||||
testRunner.OnFeatureStart(featureInfo);
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestFixtureTearDownAttribute()]
|
||||
public virtual void FeatureTearDown()
|
||||
{
|
||||
testRunner.OnFeatureEnd();
|
||||
testRunner = null;
|
||||
}
|
||||
|
||||
[NUnit.Framework.SetUpAttribute()]
|
||||
public virtual void TestInitialize()
|
||||
{
|
||||
}
|
||||
|
||||
[NUnit.Framework.TearDownAttribute()]
|
||||
public virtual void ScenarioTearDown()
|
||||
{
|
||||
testRunner.OnScenarioEnd();
|
||||
}
|
||||
|
||||
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
|
||||
{
|
||||
testRunner.OnScenarioStart(scenarioInfo);
|
||||
}
|
||||
|
||||
public virtual void ScenarioCleanup()
|
||||
{
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("I can create and publish a new Page with international characters in its route")]
|
||||
public virtual void ICanCreateAndPublishANewPageWithInternationalCharactersInItsRoute()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can create and publish a new Page with international characters in its route", ((string[])(null)));
|
||||
#line 6
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 7
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 8
|
||||
testRunner.When("I go to \"admin/contents/create/page\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table1.AddRow(new string[] {
|
||||
"Title.Title",
|
||||
"Χελλο"});
|
||||
#line 9
|
||||
testRunner.And("I fill in", ((string)(null)), table1);
|
||||
#line 12
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 13
|
||||
testRunner.And("I go to \"Χελλο\"");
|
||||
#line 14
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?Χελλο.*?</h1>\"");
|
||||
#line hidden
|
||||
this.ScenarioCleanup();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endregion
|
@ -42,6 +42,8 @@ namespace Orchard.Specs.Hosting {
|
||||
details.RequestHeaders.Add("Cookie", webHost.Cookies);
|
||||
}
|
||||
|
||||
details.RequestHeaders.Add("Accept-Charset", "utf-8");
|
||||
|
||||
if (postData != null) {
|
||||
var requestBodyText = postData
|
||||
.SelectMany(kv => kv.Value.Select(v => new { k = kv.Key, v }))
|
||||
@ -112,7 +114,7 @@ namespace Orchard.Specs.Hosting {
|
||||
: base(details.Page, details.Query, output) {
|
||||
_details = details;
|
||||
_output = output;
|
||||
PostContentType = "application/x-www-form-urlencoded";
|
||||
PostContentType = "application/x-www-form-urlencoded; charset=utf-8";
|
||||
}
|
||||
|
||||
public string PostContentType { get; set; }
|
||||
@ -177,6 +179,7 @@ namespace Orchard.Specs.Hosting {
|
||||
}
|
||||
base.SendKnownResponseHeader(index, value);
|
||||
}
|
||||
|
||||
public override void SendUnknownResponseHeader(string name, string value) {
|
||||
_details.ResponseHeaders.Add(name, value);
|
||||
|
||||
@ -184,7 +187,11 @@ namespace Orchard.Specs.Hosting {
|
||||
}
|
||||
|
||||
public override void SendResponseFromFile(string filename, long offset, long length) {
|
||||
_output.Write(File.ReadAllText(filename));
|
||||
_output.Write(System.Text.Encoding.UTF8.GetString(File.ReadAllBytes(filename)));
|
||||
}
|
||||
|
||||
public override void SendResponseFromMemory(byte[] data, int length) {
|
||||
_output.Write(System.Text.Encoding.UTF8.GetString(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,6 +150,11 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ContentTypes.feature</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Autoroute.feature.cs">
|
||||
<DependentUpon>Autoroute.feature</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Tags.feature.cs">
|
||||
<DependentUpon>Tags.feature</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
@ -267,6 +272,10 @@
|
||||
<Generator>SpecFlowSingleFileGenerator</Generator>
|
||||
<LastGenOutput>ContentTypes.feature.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Autoroute.feature">
|
||||
<Generator>SpecFlowSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Autoroute.feature.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Tags.feature">
|
||||
<Generator>SpecFlowSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Tags.feature.cs</LastGenOutput>
|
||||
|
Loading…
Reference in New Issue
Block a user