1 // Copyright 2004-2007 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
.Views
.NVelocity
.Tests
17 using NUnit
.Framework
;
18 using Castle
.MonoRail
.Framework
.Tests
;
21 public class NVelocityRescueTestCase
: RescueTestCase
24 public void RescueWithSkipRescue()
26 DoGet("rescuable/MethodWithSkipRescue.rails");
27 AssertStatusCode(500);
31 public void RescueWithAppExceptionType()
33 DoGet("rescuable/RescueWithExceptionsByType.rails", "exceptionType=appException");
37 AssertReplyEqualTo( "appException" );
41 public void RescueWithArgExceptionType()
43 DoGet("rescuable/RescueWithExceptionsByType.rails", "exceptionType=argException");
47 AssertReplyEqualTo( "argException" );
51 public void RescueWithControllerDefaultExceptionType()
53 DoGet("rescuable/RescueWithExceptionsByType.rails");
57 AssertReplyEqualTo( "An error happened" );
61 public void RescueWithMethodDefaultArgExceptionType()
63 DoGet("rescuable/RescueWithExceptionsByTypeWithDefaultException.rails", "exceptionType=argException");
67 AssertReplyEqualTo( "argException" );
71 public void RescueWithMethodDefaultExceptionType()
73 DoGet("rescuable/RescueWithExceptionsByTypeWithDefaultException.rails");
77 AssertReplyEqualTo( "methodDefaultException" );
80 [Test
, Ignore("Attributes order cannot be guaranted")]
81 public void RescueAndConrollerInheritance1()
83 DoGet("rescuable2/Save.rails");
84 AssertReplyEqualTo("An error happened during save");
86 DoGet("rescuable2/Save2.rails");
87 AssertReplyEqualTo("An error happened during update");
91 public void AccessibleThroughAndRescues()
93 DoGet("rescuable/OnlyPost.rails");
94 AssertReplyEqualTo("An error happened");