Support multiple service models for a component. WindsorServiceHostFactory will...
[castle.git] / MonoRail / Castle.MonoRail.Views.Brail.Tests / BrailRegressionTestFixture.cs
blob411d00de71fd899794c4e4511fc112a57aeabcbd
1 // Copyright 2004-2008 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 NUnit.Framework;
19 [TestFixture]
20 public class BrailRegressionTestFixture : BaseViewOnlyTestFixture
22 public BrailRegressionTestFixture()
23 : base(ViewLocations.BrailTestsView)
28 [Test]
29 public void CanCompareToNullableParameter()
31 PropertyBag["myVariable"] = "Hello";
32 ProcessView("regressions/CanCompareToNullableParameter");
33 AssertReplyEqualTo("Eq");
36 [Test]
37 public void CanUseQuestionMarkOperatorInIfStatementToValidatePresenceOfParameter()
39 ProcessView("regressions/questionMarkOp_if");
40 AssertReplyEqualTo("");
43 [Test]
44 public void CanUseQuestionMarkOperatorInIfStatementToValidatePresenceOfParameter_WhenPassed()
46 PropertyBag["errorMsg"] = "Hello";
47 ProcessView("regressions/questionMarkOp_if_whenPassed");
48 AssertReplyEqualTo("Hello");
51 [Test]
52 public void CanUseQuestionMarkOperatorInIfStatementToValidatePresenceOfParameter_WhenExists()
54 PropertyBag["Errors"] = new string[] {"Hello",};
55 ProcessView("regressions/questionMarkOp_if_when_exists");
56 AssertReplyEqualTo("Hello<br />\r\n");
60 [Test]
61 public void CanUseQuestionMarkOperatorInIfStatementToValidatePresenceOfParameter_WhenMissing()
63 ProcessView("regressions/questionMarkOp_if_when_missing");
64 AssertReplyEqualTo("");
67 [Test]
68 public void CanUseQuestionMarkOperatorInUnlessStatementToValidatePresenceOfParameter()
70 string view = ProcessView("regressions/questionMarkOp_unless");
71 Assert.AreEqual("\r\nError does not exist\r\n", view);
74 [Test]
75 public void CanUseQuestionMarkOperatorInUnlessStatementToValidatePresenceOfParameter_whenPassed()
78 PropertyBag["errorMsg"] = "Hello";
79 string view = ProcessView("regressions/questionMarkOp_unless_whenPassed");
80 Assert.AreEqual("", view);
84 [Test]
85 public void HtmlEncodingStringInterpolation()
87 PropertyBag["htmlCode"] = "<script>alert('a');</script>";
88 string view = ProcessView("regressions/HtmlEncodingStringInterpolation");
89 Assert.AreEqual("&lt;script&gt;alert('a');&lt;/script&gt;", view);
92 [Test]
93 public void StringInterpolationInCodeBlockWillNotBeEscaped()
95 PropertyBag["htmlCode"] = "<script>alert('a');</script>";
96 string view = ProcessView("regressions/StringInterpolationInCodeBlockWillNotBeEscaped");
97 Assert.AreEqual("<script>alert('a');</script>", view);
100 [Test]
101 public void CanUseViewFromResource()
103 string view = ProcessView("login/welcome");
104 Assert.AreEqual("Hi there, anonymous user!", view);