Fix the build.
[castle.git] / MonoRail / Castle.MonoRail.Framework.Tests / Helpers / HtmlHelperTestCase.cs
blobe25c0420e3e9a8a8e3f608d7cc8de85f7b598903
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.Helpers
17 using System;
19 using NUnit.Framework;
21 using Castle.MonoRail.Framework.Helpers;
24 [TestFixture]
25 public class HtmlHelperTestCase : AbstractTestCase
27 [Test]
28 public void FormTag()
30 HtmlHelper helper = new HtmlHelper();
31 Assert.AreEqual( "<form method=\"post\" action=\"something.rails\">" + Environment.NewLine,
32 helper.Form("something.rails") );
35 [Test]
36 public void EndFormTag()
38 HtmlHelper helper = new HtmlHelper();
39 Assert.AreEqual( "</form>", helper.EndForm() );
42 [Test]
43 public void LabelFor()
45 HtmlHelper helper = new HtmlHelper();
46 Assert.AreEqual( "<label for=\"x\">name</label>" + Environment.NewLine, helper.LabelFor("x", "name") );
49 [Test]
50 public void BuildUnorderedList1()
52 String[] args = new String[] { "arg1", "arg2" };
53 HtmlHelper helper = new HtmlHelper();
54 Assert.AreEqual( "<ul>" + Environment.NewLine + "<li>arg1</li>" + Environment.NewLine + "<li>arg2</li>" + Environment.NewLine + "</ul>" + Environment.NewLine,
55 helper.BuildUnorderedList(args) );
58 [Test]
59 public void BuildUnorderedList2()
61 String[] args = new String[] { "arg1" };
62 HtmlHelper helper = new HtmlHelper();
63 Assert.AreEqual( "<ul class=\"style1\">" + Environment.NewLine + "<li class=\"style2\">arg1</li>" + Environment.NewLine + "</ul>" + Environment.NewLine,
64 helper.BuildUnorderedList(args, "style1", "style2") );
67 [Test]
68 public void LinkTo()
70 DoGet("helper/linkto.rails", "name=Click", "action=href");
72 AssertSuccess();
73 AssertReplyEqualTo("<a href=\"/helper/href.rails\">Click</a>");
75 DoGet("test/helper2/linkto.rails", "name=Click", "action=href");
77 AssertSuccess();
78 AssertReplyEqualTo("<a href=\"/test/helper2/href.rails\">Click</a>");