Added non-generic registration interface to IKernel and IWindsor to accommodate dynam...
[castle.git] / MonoRail / Castle.MonoRail.Views.Brail.Tests / BrailRegressionTestFixture.cs
blob306028de6c2da0728a25f2b5ee2675e4a195339b
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.Views.Brail.Tests
17 using System.Collections;
18 using NUnit.Framework;
20 [TestFixture]
21 public class BrailRegressionTestFixture : BaseViewOnlyTestFixture
23 [Test]
24 public void CanCompareToNullableParameter()
26 Hashtable args = new Hashtable();
27 args["myVariable"] = "Hello";
28 string view = ProcessView(args, "regressions/CanCompareToNullableParameter");
29 Assert.AreEqual("Eq", view);
32 [Test]
33 public void CanUseQuestionMarkOperatorInIfStatementToValidatePresenceOfParameter()
35 string view = ProcessView("regressions/questionMarkOp_if");
36 Assert.AreEqual("", view);
39 [Test]
40 public void CanUseQuestionMarkOperatorInIfStatementToValidatePresenceOfParameter_WhenPassed()
42 Hashtable args = new Hashtable();
43 args["errorMsg"] = "Hello";
44 string view = ProcessView(args, "regressions/questionMarkOp_if_whenPassed");
45 Assert.AreEqual("Hello", view);
48 [Test]
49 public void CanUseQuestionMarkOperatorInIfStatementToValidatePresenceOfParameter_WhenExists()
51 Hashtable args = new Hashtable();
52 args["Errors"] = new string[] {"Hello",};
53 string view = ProcessView(args, "regressions/questionMarkOp_if_when_exists");
54 Assert.AreEqual("Hello<br />\r\n", view);
58 [Test]
59 public void CanUseQuestionMarkOperatorInIfStatementToValidatePresenceOfParameter_WhenMissing()
61 Hashtable args = new Hashtable();
62 string view = ProcessView(args, "regressions/questionMarkOp_if_when_missing");
63 Assert.AreEqual("", view);
66 [Test]
67 public void CanUseQuestionMarkOperatorInUnlessStatementToValidatePresenceOfParameter()
69 string view = ProcessView("regressions/questionMarkOp_unless");
70 Assert.AreEqual("\r\nError does not exist\r\n", view);
73 [Test]
74 public void CanUseQuestionMarkOperatorInUnlessStatementToValidatePresenceOfParameter_whenPassed()
76 Hashtable args = new Hashtable();
77 args["errorMsg"] = "Hello";
78 string view = ProcessView(args, "regressions/questionMarkOp_unless_whenPassed");
79 Assert.AreEqual("", view);
83 [Test]
84 public void HtmlEncodingStringInterpolation()
86 Hashtable args = new Hashtable();
87 args["htmlCode"] = "<script>alert('a');</script>";
88 string view = ProcessView(args, "regressions/HtmlEncodingStringInterpolation");
89 Assert.AreEqual("&lt;script&gt;alert('a');&lt;/script&gt;", view);
92 [Test]
93 public void StringInterpolationInCodeBlockWillNotBeEscaped()
95 Hashtable args = new Hashtable();
96 args["htmlCode"] = "<script>alert('a');</script>";
97 string view = ProcessView(args, "regressions/StringInterpolationInCodeBlockWillNotBeEscaped");
98 Assert.AreEqual("<script>alert('a');</script>", view);
101 [Test]
102 public void CanUseViewFromResource()
104 string view = ProcessView("login/welcome");
105 Assert.AreEqual("Hi there, anonymous user!", view);