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.
14 namespace Castle
.MonoRail
.Views
.Brail
.Tests
17 using Castle
.MonoRail
.Framework
.Tests
;
18 using NUnit
.Framework
;
21 public class BrailSubViewTestCase
: AbstractTestCase
24 public void BrailWillCacheSubViewsWhenUsingForwardSlash()
26 DoGet("subview/useLotsOfSubViews.rails");
27 StringBuilder sb
= new StringBuilder();
28 for (int i
= 0; i
< 50; i
++)
32 string expected
= sb
.ToString();
33 AssertReplyEqualTo(expected
);
35 // Here we tell the controller to replace the subview with a dummy implementation
36 // if brail doesn't cache it, it will use the real implementation, and the test will fail.
37 sb
= new StringBuilder();
38 for (int i
= 0; i
< 50; i
++)
42 DoGet("subview/useLotsOfSubViews.rails", "replaceSubView=true");
43 expected
= sb
.ToString();
44 AssertReplyEqualTo(expected
);
48 public void CanCallSubViews()
50 DoGet("subview/index.rails");
51 string expected
= "View With SubView Content\r\nFrom SubView";
52 AssertReplyEqualTo(expected
);
56 public void CanCallSubViewWithPath()
58 DoGet("subview/SubViewWithPath.rails");
59 string expected
= "View With SubView Content\r\nContents for heyhello View";
60 AssertReplyEqualTo(expected
);
64 public void SubViewWithLayout()
66 DoGet("subview/SubViewWithLayout.rails");
67 string expected
= "\r\nWelcome!\r\n<p>View With SubView Content\r\nFrom SubView</p>\r\nFooter";
68 AssertReplyEqualTo(expected
);
72 public void SubViewWithParameters()
74 DoGet("subview/SubViewWithParameters.rails");
75 string expected
= "View SubView Content With Parameters\r\nMonth: 0\r\nAllow Select: False";
76 AssertReplyEqualTo(expected
);