Fixing an issue with output parameters that are of type IntPtr
[castle.git] / MonoRail / Castle.MonoRail.Views.Brail.Tests / LanguageFeatures.cs
bloba45e85e1619a14ab74a12f48886c6e56863af15e
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;
18 using Castle.MonoRail.Views.Brail.TestSite.Controllers;
19 using DynamicProxy;
20 using NUnit.Framework;
22 [TestFixture]
23 public class LanguageFeatures : BaseViewOnlyTestFixture
25 [Test]
26 public void CanHandleDynamicProxyObjects()
28 ProxyGenerator generator = new ProxyGenerator();
29 object o = generator.CreateClassProxy(typeof(HomeController.SimpleProxy), new StandardInterceptor());
30 try
32 o.GetType().GetProperty("Text");
33 throw new InvalidOperationException("Should have gotten AmbiguousMatchException here");
35 catch
38 PropertyBag["src"] = o;
40 string expected = "<?xml version=\"1.0\" ?>\r\n" +
41 @"<html>
42 <h1>BarBaz</h1>
43 </html>";
44 // should not raise ambigious match exception
45 ProcessView_StripRailsExtension("Home/withDynamicProxyObject.rails");
46 AssertReplyEqualTo(expected);
49 [Test]
50 public void NullableProperties()
52 Foo[] fooArray1 = new Foo[] { new Foo("Bar"), new Foo(null), new Foo("Baz") };
53 this.PropertyBag.Add("List", fooArray1);
55 string expected = "<?xml version=\"1.0\" ?>\r\n" +
56 @"<html>
57 <h1>BarBaz</h1>
58 </html>";
59 // should not raise null exception
60 ProcessView_StripRailsExtension("Home/nullableProperties.rails");
61 AssertReplyEqualTo(expected);