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
.Framework
.Tests
.Actions
17 using NUnit
.Framework
;
18 using Castle
.MonoRail
.Framework
.Test
;
21 public class DynamicActionExecutorTestCase
24 public void DelegatesToDynamicAction()
26 ActionStub dynAction
= new ActionStub();
28 DynamicActionExecutor executor
= new DynamicActionExecutor(dynAction
);
30 MockRequest req
= new MockRequest();
31 MockResponse res
= new MockResponse();
32 MockServices services
= new MockServices();
33 IEngineContext engineContext
= new MockEngineContext(req
, res
, services
, new UrlInfo("area", "controller", "action"));
35 object retVal
= executor
.Execute(engineContext
, new DummyController(), new ControllerContext());
36 Assert
.IsTrue(dynAction
.WasExecuted
);
37 Assert
.AreEqual(3, retVal
);
40 public class ActionStub
: IDynamicAction
42 private bool wasExecuted
;
44 public object Execute(IEngineContext engineContext
, IController controller
, IControllerContext controllerContext
)
50 public bool WasExecuted
52 get { return wasExecuted; }
56 public class DummyController
: Controller