1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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
;
21 /// This fixture asserts that Poco are accept as controllers, although
22 /// this use presents some design differences
24 [TestFixture
, Category(TestCategories
.Core
)]
25 public class PocoControllerSupportTestCase
27 private PocoController controller
;
28 private IExecutionContext testContext
;
31 public void CreateObjects()
33 controller
= new PocoController();
34 testContext
= new TestContext(new UrlInfo("area", "controller", "index"));
38 public void ExecutorDoesNotFailToAcceptPoco()
40 new ControllerExecutor(controller
, testContext
);
42 // How Can I write an assert for that?
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