Fix the build.
[castle.git] / MonoRail / Castle.MonoRail.Framework.Tests / Helpers / ValidationHelperTestCase.cs
blob723d0a23572be644d961d7f0258b8d7911399e41
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;
23 [TestFixture]
24 public class ValidationHelperTestCase
26 private ValidationHelper _helper;
28 public ValidationHelperTestCase()
32 [SetUp]
33 public void Init()
35 _helper = new ValidationHelper();
38 [Test, Ignore("We need to mock the controller and the request/context to be able to run this one")]
39 public void AutoScriptInstaller()
41 Assert.AreEqual("<script type=\"text/javascript\" src=\"vdir/MonoRail/Files/ValidateConfig.rails\"></script>\r\n" +
42 "<script type=\"text/javascript\" src=\"vdir/MonoRail/Files/ValidateCore.rails\"></script>\r\n" +
43 "<script type=\"text/javascript\" src=\"vdir/MonoRail/Files/ValidateValidators.rails\"></script>\r\n"+
44 "<script type=\"text/javascript\" src=\"vdir/MonoRail/Files/ValidateLang.rails\"></script>\r\n",
45 _helper.InstallScripts());
48 [Test]
49 public void DefaultValidationTriggerFunction()
51 Assert.AreEqual("return validateForm( this, false, false, false, false, 0 );",
52 _helper.GetValidationTriggerFunction());
55 [Test]
56 public void CustomValidationTriggerFunction()
58 Assert.AreEqual("return validateForm( document.forms[0], false, false, false, false, 0 );",
59 _helper.GetValidationTriggerFunction("document.forms[0]"));
62 [Test]
63 public void OverrideDefaults()
65 _helper.SetSubmitOptions(true, true, true, 1);
67 Assert.AreEqual("return validateForm( this, true, true, true, true, 1 );",
68 _helper.GetValidationTriggerFunction());