Refactored the Kernel registration fluent interface to be more readable, better suppo...
[castle.git] / MonoRail2 / Castle.MonoRail.Tests / PocoControllerSupportTestCase.cs
blob3f89129155a77b843264553f35efdae848744f2d
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 /// <summary>
21 /// This fixture asserts that Poco are accept as controllers, although
22 /// this use presents some design differences
23 /// </summary>
24 [TestFixture, Category(TestCategories.Core)]
25 public class PocoControllerSupportTestCase
27 private PocoController controller;
28 private IExecutionContext testContext;
30 [SetUp]
31 public void CreateObjects()
33 controller = new PocoController();
34 testContext = new TestContext(new UrlInfo("area", "controller", "index"));
37 [Test]
38 public void ExecutorDoesNotFailToAcceptPoco()
40 new ControllerExecutor(controller, testContext);
42 // How Can I write an assert for that?
45 [Test]
46 public void ActionIsSelectedAndRun()
48 ControllerExecutor executor = new ControllerExecutor(controller, testContext);
50 ActionExecutor actionExec = executor.SelectAction();
52 Assert.IsNotNull(actionExec);
53 Assert.AreEqual(ActionType.Method, actionExec.ActionType);
54 Assert.AreEqual("Index", actionExec.Name);
56 executor.Execute(actionExec);
58 Assert.IsTrue(controller.wasRun);
61 public class PocoController
63 public bool wasRun;
65 public void Index()
67 wasRun = true;