Fixing an issue with output parameters that are of type IntPtr
[castle.git] / MonoRail2 / Castle.MonoRail.Tests / ControllerExecutorTestCase.cs
blobf5a6ce3b7f6a12af5fc046d5cf3f8950622a2012
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.MonoRail.Tests
17 using Castle.MonoRail.Test;
18 using NUnit.Framework;
20 [TestFixture, Category(TestCategories.Core)]
21 public class ControllerExecutorTestCase
23 private SimpleController controller;
24 private IExecutionContext testContext;
26 [SetUp]
27 public void CreateObjects()
29 controller = new SimpleController();
30 testContext = new TestContext(new UrlInfo("area", "controller", "index"));
33 [Test]
34 public void ControllerStateIsProperlyInitialized()
36 new ControllerExecutor(controller, testContext);
38 Assert.AreEqual("area", controller.AreaName);
39 Assert.AreEqual("controller", controller.Name);
40 Assert.AreEqual("index", controller.ActionName);
43 [Test]
44 public void ActionIsSelectedBasedOnUrlActionPiece()
46 ControllerExecutor executor = new ControllerExecutor(controller, testContext);
48 ActionExecutor actionExec = executor.SelectAction();
50 Assert.IsNotNull(actionExec);
51 Assert.AreEqual(ActionType.Method, actionExec.ActionType);
52 Assert.AreEqual("Index", actionExec.Name);
55 [Test]
56 public void ActionIsExecuted()
58 ControllerExecutor executor = new ControllerExecutor(controller, testContext);
60 executor.Execute(executor.SelectAction());
62 Assert.IsTrue(controller.wasRun, "ControllerExecutor failed to execute the action");
65 public class SimpleController : Controller
67 public bool wasRun;
69 public void Index()
71 wasRun = true;