Minor style changes
[castle.git] / MonoRail / Castle.MonoRail.Framework.Tests / FilterTestCase.cs
blobb0fc01a8262bd342891e29e77907ab9beb5fcdee
1 // Copyright 2004-2007 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.Framework.Tests
17 using NUnit.Framework;
19 using Castle.MonoRail.TestSupport;
21 [TestFixture]
22 public class FilterTestCase : AbstractTestCase
24 [Test]
25 public void SkipFilter()
27 DoGet("filtered/index.rails");
29 AssertSuccess();
31 AssertReplyEqualTo( "Filtered Action Index" );
34 [Test]
35 public void FilteredActionWithRenderText()
37 DoGet("filtered/save.rails");
39 AssertSuccess();
41 AssertReplyEqualTo( "(before)content(after)" );
44 [Test]
45 public void FilteredActionWithView()
47 DoGet("filtered/update.rails");
49 AssertSuccess();
51 AssertReplyEqualTo( "(before)update view contents(after)" );
54 [Test]
55 public void SelectiveSkipFilter()
57 DoGet("filtered/selectiveSkip.rails");
59 AssertSuccess();
61 AssertReplyEqualTo( "selectiveSkip view contents" );
64 [Test]
65 public void BeforeFilter_SkipFilter()
67 DoGet("filtered2/index.rails");
69 AssertSuccess();
71 AssertReplyEqualTo( "index view contents" );
74 [Test]
75 public void BeforeFilter_Filtered()
77 DoGet("filtered2/update.rails");
79 AssertSuccess();
81 AssertReplyEqualTo( "(before)update view contents" );
84 [Test]
85 public void InvalidCondition()
87 Request.Headers.Add("mybadheader", "somevalue");
89 DoGet("filter/index.rails");
91 AssertSuccess();
93 AssertReplyEqualTo("Denied!");
96 [Test]
97 public void ValidCondition()
99 DoGet("filter/index.rails");
101 AssertSuccess();
103 AssertReplyEqualTo("View contents!");
106 [Test]
107 public void ExecutionOrder()
109 DoGet("FilterOrder/index.rails");
111 AssertSuccess();
113 // StartRequest: AB
114 // BeforeAction: AB
115 // Action: Index
116 // AfterAction: AB
117 // AfterRendering: AB
119 AssertReplyEqualTo("ABABIndexABAB");