User: johnsimons
Date: 2010/01/05 03:55 AM
Added:
/MonoRail/trunk/src/Castle.MonoRail.Framework.Tests/Bugs/
MR-ISSUE-518.cs
Modified:
/MonoRail/trunk/src/Castle.MonoRail.Framework.Tests/
Castle.MonoRail.Framework.Tests-vs2008.csproj
/MonoRail/trunk/src/Castle.MonoRail.Framework/Internal/
CommonUtils.cs
Log:
Fixed MR-ISSUE-518
File Changes:
Directory: /MonoRail/trunk/src/Castle.MonoRail.Framework.Tests/Bugs/
====================================================================
File [added]: MR-ISSUE-518.cs
Delta lines: +1 -0
===================================================================
---
MonoRail/trunk/src/Castle.MonoRail.Framework.Tests/Castle.MonoRail.Framework.Tests-vs2008.csproj
2010-01-05 02:45:35 UTC (rev 6569)
+++
MonoRail/trunk/src/Castle.MonoRail.Framework.Tests/Castle.MonoRail.Framework.Tests-vs2008.csproj
2010-01-05 10:55:53 UTC (rev 6570)
@@ -174,6 +174,7 @@
<Compile Include="Async\ControllerWithTwoBeginIndex.cs" />
<Compile Include="Async\ControllerWithTwoEndActions.cs" />
<Compile Include="Bugs\MR-ISSUE-472.cs" />
+ <Compile Include="Bugs\MR-ISSUE-518.cs" />
<Compile Include="Bugs\MR-ISSUE-535.cs" />
<Compile Include="Bugs\MR-ISSUE-476.cs" />
Directory: /MonoRail/trunk/src/Castle.MonoRail.Framework.Tests/
===============================================================
File [modified]: Castle.MonoRail.Framework.Tests-vs2008.csproj
Delta lines: +0 -0
===================================================================
Directory: /MonoRail/trunk/src/Castle.MonoRail.Framework/Internal/
==================================================================
File [modified]: CommonUtils.cs
Delta lines: +77 -0
===================================================================
--- MonoRail/trunk/src/Castle.MonoRail.Framework.Tests/Bugs/MR-ISSUE-518.cs
(rev 0)
+++ MonoRail/trunk/src/Castle.MonoRail.Framework.Tests/Bugs/MR-ISSUE-518.cs
2010-01-05 10:55:53 UTC (rev 6570)
@@ -0,0 +1,77 @@
+namespace Castle.MonoRail.Framework.Tests.Bugs
+{
+ using System.Collections.Specialized;
+ using NUnit.Framework;
+ using Test;
+
+ [TestFixture]
+ public class MR_ISSUE_518
+ {
+ StubRequest request;
+ StubResponse response;
+ StubMonoRailServices services;
+ StubEngineContext engineContext;
+
+ [SetUp]
+ public void Init()
+ {
+ request = new StubRequest();
+ response = new StubResponse();
+ services = new StubMonoRailServices();
+ services = new StubMonoRailServices { ViewEngineManager
= new StubViewEngineManager() };
+ engineContext = new StubEngineContext(request,
response, services, null);
+ }
+
+ [Test]
+ public void Controller_RedirectToAction_With_Specified_Anchor()
+ {
+ services.UrlBuilder.UseExtensions = false;
+
+ var controller = new ControllerWithRedirect();
+
+ var context = services.ControllerContextFactory.
+ Create("", "home",
"RedirectToActionWithAnchor",
services.ControllerDescriptorProvider.BuildDescriptor(controller));
+
+ engineContext.CurrentController = controller;
+ engineContext.CurrentControllerContext = context;
+
+ controller.Process(engineContext, context);
+
+ Assert.IsTrue(response.WasRedirected);
+ Assert.That(response.RedirectedTo,
Is.EqualTo("/home/action?id=1#tab1"));
+ }
+
+ [Test]
+ public void
Controller_RedirectToAction_With_Specified_Anchor_Using_NameValueCollection()
+ {
+ services.UrlBuilder.UseExtensions = false;
+
+ var controller = new ControllerWithRedirect();
+
+ var context = services.ControllerContextFactory.
+ Create("", "home",
"RedirectToActionWithAnchorPassingNameValueCollection",
services.ControllerDescriptorProvider.BuildDescriptor(controller));
+
+ engineContext.CurrentController = controller;
+ engineContext.CurrentControllerContext = context;
+
+ controller.Process(engineContext, context);
+
+ Assert.IsTrue(response.WasRedirected);
+ Assert.That(response.RedirectedTo,
Is.EqualTo("/home/action?id=1#tab1"));
+ }
+
+ class ControllerWithRedirect : Controller
+ {
+ public void RedirectToActionWithAnchor()
+ {
+ RedirectToAction("action", "id=1", "#tab1");
+ }
+
+ public void
RedirectToActionWithAnchorPassingNameValueCollection()
+ {
+ NameValueCollection urlParams = new
NameValueCollection {{"id", "1"}, {"#tab1", ""}};
+ RedirectToAction("action", urlParams);
+ }
+ }
+ }
+}
--
You received this message because you are subscribed to the Google Groups
"Castle Project Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-commits?hl=en.