mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
@@ -181,6 +181,7 @@
|
||||
<Compile Include="Widgets\RuleEngine\UrlRuleProviderTest.cs" />
|
||||
<Compile Include="Widgets\Services\WidgetsServiceTest.cs" />
|
||||
<Compile Include="Widgets\WidgetsTests.cs" />
|
||||
<Compile Include="Workflows\Activities\WebRequestActivityTests.cs" />
|
||||
<Compile Include="XmlRpc\Controllers\LiveWriterControllerTests.cs" />
|
||||
<Compile Include="XmlRpc\Controllers\HomeControllerTests.cs" />
|
||||
<Compile Include="XmlRpc\Services\XmlRpcReaderTests.cs" />
|
||||
@@ -279,6 +280,10 @@
|
||||
<Project>{194D3CCC-1153-474D-8176-FDE8D7D0D0BD}</Project>
|
||||
<Name>Orchard.Widgets</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Web\Modules\Orchard.Workflows\Orchard.Workflows.csproj">
|
||||
<Project>{7059493C-8251-4764-9C1E-2368B8B485BC}</Project>
|
||||
<Name>Orchard.Workflows</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard\Orchard.Framework.csproj">
|
||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||
<Name>Orchard.Framework</Name>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Workflows.Activities;
|
||||
|
||||
namespace Orchard.Tests.Modules.Workflows.Activities {
|
||||
[TestFixture]
|
||||
public class WebRequestActivityTests {
|
||||
|
||||
private readonly MethodInfo _parseKeyValueString = typeof(WebRequestActivity).GetMethod("ParseKeyValueString", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
|
||||
private IEnumerable<KeyValuePair<string, string>> ParseKeyValueString(string text) {
|
||||
return (IEnumerable<KeyValuePair<string, string>>)_parseKeyValueString.Invoke(null, new object[] { text });
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseKeyValueStringShouldRecognizeNewLinePatterns() {
|
||||
Assert.That(ParseKeyValueString("a=b\nc=d\r\ne=f"), Is.EquivalentTo( new Dictionary<string, string> { {"a", "b"}, {"c", "d"}, {"e","f"}}));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseKeyValueStringShouldIgnoreComments() {
|
||||
Assert.That(ParseKeyValueString("a=b\n#c=d\ne=f"), Is.EquivalentTo(new Dictionary<string, string> { { "a", "b" }, { "e", "f" } }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseKeyValueStringShouldIgnoreEmptyLines() {
|
||||
Assert.That(ParseKeyValueString("a=b\n\n\n\n\ne=f"), Is.EquivalentTo(new Dictionary<string, string> { { "a", "b" }, { "e", "f" } }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseKeyValueStringShouldIgnoreMalformedLines() {
|
||||
Assert.That(ParseKeyValueString("a=b\nc:d\ne=f"), Is.EquivalentTo(new Dictionary<string, string> { { "a", "b" }, { "e", "f" } }));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user