SPRNET-1271

-cannot reproduce
-added unit tests around the HandlerMap class' MapPath() method so that if a subsequent example of the behavior reported in this issue is provided we can properly test against it
This commit is contained in:
sbohlen
2010-08-03 15:14:41 +00:00
parent 9998999a95
commit b351bc2f21
2 changed files with 48 additions and 0 deletions

View File

@@ -128,6 +128,7 @@
<Compile Include="Web\Support\ControlInterceptionTests.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Web\Support\HandlerMapTests.cs" />
<Compile Include="Web\Support\LocalResourceManagerTests.cs" />
<Compile Include="Web\Support\MimeMediaTypeTests.cs" />
<Compile Include="Web\Support\PageHandlerFactoryTests.cs" />

View File

@@ -0,0 +1,47 @@
using System;
using System.Text;
using NUnit.Framework;
namespace Spring.Web.Support
{
[TestFixture]
public class HandlerMapTests
{
[Test]
public void CanMatch_EmbeddedLiteralsPattern()
{
HandlerMap map = new HandlerMap();
map.Add("/*/test2/*", "theHandlerIWant");
HandlerMapEntry handler = map.MapPath("/test1/test2/default.aspx");
Assert.NotNull(handler);
Assert.AreEqual("theHandlerIWant", handler.HandlerObjectName);
}
[Test]
public void CanMatch_ExactStringPatterns()
{
HandlerMap map = new HandlerMap();
map.Add("/test1/test2/default.aspx", "theHandlerIWant");
HandlerMapEntry handler = map.MapPath("/test1/test2/default.aspx");
Assert.NotNull(handler);
Assert.AreEqual("theHandlerIWant", handler.HandlerObjectName);
}
[Test]
public void CanMatch_LeadingLiteralsPattern()
{
HandlerMap map = new HandlerMap();
map.Add("/test1/*", "theHandlerIWant");
HandlerMapEntry handler = map.MapPath("/test1/test2/default.aspx");
Assert.NotNull(handler);
Assert.AreEqual("theHandlerIWant", handler.HandlerObjectName);
}
}
}