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
.Tests
17 using NUnit
.Framework
;
19 using Castle
.MonoRail
.TestSupport
;
22 public class FilterTestCase
: AbstractTestCase
25 public void SkipFilter()
27 DoGet("filtered/index.rails");
31 AssertReplyEqualTo( "Filtered Action Index" );
35 public void FilteredActionWithRenderText()
37 DoGet("filtered/save.rails");
41 AssertReplyEqualTo( "(before)content(after)" );
45 public void FilteredActionWithView()
47 DoGet("filtered/update.rails");
51 AssertReplyEqualTo( "(before)update view contents(after)" );
55 public void SelectiveSkipFilter()
57 DoGet("filtered/selectiveSkip.rails");
61 AssertReplyEqualTo( "selectiveSkip view contents" );
65 public void BeforeFilter_SkipFilter()
67 DoGet("filtered2/index.rails");
71 AssertReplyEqualTo( "index view contents" );
75 public void BeforeFilter_Filtered()
77 DoGet("filtered2/update.rails");
81 AssertReplyEqualTo( "(before)update view contents" );
85 public void InvalidCondition()
87 Request
.Headers
.Add("mybadheader", "somevalue");
89 DoGet("filter/index.rails");
93 AssertReplyEqualTo("Denied!");
97 public void ValidCondition()
99 DoGet("filter/index.rails");
103 AssertReplyEqualTo("View contents!");
107 public void ExecutionOrder()
109 DoGet("FilterOrder/index.rails");
117 // AfterRendering: AB
119 AssertReplyEqualTo("ABABIndexABAB");