More working tests.
[castle.git] / MonoRail / Castle.MonoRail.Views.Brail.Tests / BrailRegressionTestFixture.cs
blobe897affda0def17fdefe8ef75667debb79a4724a
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 System.Collections;
18 using System.Collections.Generic;
19 using NUnit.Framework;
21 [TestFixture]
22 public class BrailRegressionTestFixture : BaseViewOnlyTestFixture
24 public BrailRegressionTestFixture()
25 : base("../../../Castle.MonoRail.Views.Brail.Tests")
30 [Test]
31 public void CanCompareToNullableParameter()
33 PropertyBag["myVariable"] = "Hello";
34 ProcessView("regressions/CanCompareToNullableParameter");
35 AssertReplyEqualTo("Eq");
38 [Test]
39 public void CanUseQuestionMarkOperatorInIfStatementToValidatePresenceOfParameter()
41 ProcessView("regressions/questionMarkOp_if");
42 AssertReplyEqualTo("");
45 [Test]
46 public void CanUseQuestionMarkOperatorInIfStatementToValidatePresenceOfParameter_WhenPassed()
48 PropertyBag["errorMsg"] = "Hello";
49 ProcessView("regressions/questionMarkOp_if_whenPassed");
50 AssertReplyEqualTo("Hello");
53 [Test]
54 public void CanUseQuestionMarkOperatorInIfStatementToValidatePresenceOfParameter_WhenExists()
56 PropertyBag["Errors"] = new string[] {"Hello",};
57 ProcessView("regressions/questionMarkOp_if_when_exists");
58 AssertReplyEqualTo("Hello<br />\r\n");
62 [Test]
63 public void CanUseQuestionMarkOperatorInIfStatementToValidatePresenceOfParameter_WhenMissing()
65 ProcessView("regressions/questionMarkOp_if_when_missing");
66 AssertReplyEqualTo("");
69 [Test]
70 public void CanUseQuestionMarkOperatorInUnlessStatementToValidatePresenceOfParameter()
72 string view = ProcessView("regressions/questionMarkOp_unless");
73 Assert.AreEqual("\r\nError does not exist\r\n", view);
76 [Test]
77 public void CanUseQuestionMarkOperatorInUnlessStatementToValidatePresenceOfParameter_whenPassed()
80 PropertyBag["errorMsg"] = "Hello";
81 string view = ProcessView("regressions/questionMarkOp_unless_whenPassed");
82 Assert.AreEqual("", view);
86 [Test]
87 public void HtmlEncodingStringInterpolation()
89 PropertyBag["htmlCode"] = "<script>alert('a');</script>";
90 string view = ProcessView("regressions/HtmlEncodingStringInterpolation");
91 Assert.AreEqual("&lt;script&gt;alert('a');&lt;/script&gt;", view);
94 [Test]
95 public void StringInterpolationInCodeBlockWillNotBeEscaped()
97 PropertyBag["htmlCode"] = "<script>alert('a');</script>";
98 string view = ProcessView("regressions/StringInterpolationInCodeBlockWillNotBeEscaped");
99 Assert.AreEqual("<script>alert('a');</script>", view);
102 [Test]
103 public void CanUseViewFromResource()
105 string view = ProcessView("login/welcome");
106 Assert.AreEqual("Hi there, anonymous user!", view);