From 13faedc6f8c8b9de3e61df0982197e40de2760e9 Mon Sep 17 00:00:00 2001 From: ayende Date: Thu, 22 Nov 2007 21:55:29 +0000 Subject: [PATCH] Fixing broken test. Enabling Brail tests in the default build. git-svn-id: https://svn.castleproject.org/svn/castle/trunk@4513 73e77b4c-caa6-f847-a29a-24ab75ae54b6 --- .../TestSiteBrail/Controllers/SubViewController.cs | 135 +++++++++++---------- MonoRail/monorail.build | 4 +- 2 files changed, 70 insertions(+), 69 deletions(-) rewrite MonoRail/TestSiteBrail/Controllers/SubViewController.cs (75%) diff --git a/MonoRail/TestSiteBrail/Controllers/SubViewController.cs b/MonoRail/TestSiteBrail/Controllers/SubViewController.cs dissimilarity index 75% index 80217c145..e382f3cb4 100644 --- a/MonoRail/TestSiteBrail/Controllers/SubViewController.cs +++ b/MonoRail/TestSiteBrail/Controllers/SubViewController.cs @@ -1,67 +1,68 @@ -// Copyright 2004-2007 Castle Project - http://www.castleproject.org/ -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -namespace Castle.MonoRail.Views.Brail.TestSite.Controllers -{ - using Castle.MonoRail.Framework; - using Castle.MonoRail.Views.Brail; - using System; - using System.Collections; - using System.IO; - using System.Reflection; - - [Serializable] - public class SubViewController : Controller - { - public void Index() - { - } - - public void SubViewWithLayout() - { - this.LayoutName = "master"; - this.RenderView("index"); - } - - public void SubViewWithParameters() - { - this.RenderView("CallSubViewWithParameters"); - } - - public void SubViewWithPath() - { - } - - public void useLotsOfSubViews() - { - //this is ugly, but the other way is to open up things that really shouldn't be opened... - IViewEngineManager viewEngineManager = (IViewEngineManager)this.ServiceProvider.GetService(typeof(IViewEngineManager)); - IViewEngine engine1 = (IViewEngine)viewEngineManager.GetType().GetMethod("ResolveEngine", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(viewEngineManager, new object[] { "dummy.brail" }); - Hashtable hashtable1 = (Hashtable) typeof(BooViewEngine).GetField("compilations", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(engine1); - Hashtable hashtable2 = (Hashtable) typeof(BooViewEngine).GetField("constructors", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(engine1); - if (this.Context.Request.QueryString["replaceSubView"] == "reset") - { - hashtable1[@"subview\listItem.brail"] = null; - } - else if (this.Context.Request.QueryString["replaceSubView"] == "true") - { - hashtable1[@"subview\listItem.brail"] = typeof(DummySubView); - Type[] typeArray1 = new Type[] { typeof(BooViewEngine), typeof(TextWriter), typeof(IRailsEngineContext), typeof(Controller) }; - hashtable2[typeof(DummySubView)] = typeof(DummySubView).GetConstructor(typeArray1); - } - } - - } -} - +// Copyright 2004-2007 Castle Project - http://www.castleproject.org/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +namespace Castle.MonoRail.Views.Brail.TestSite.Controllers +{ + using Castle.MonoRail.Framework; + using Castle.MonoRail.Views.Brail; + using System; + using System.Collections; + using System.IO; + using System.Reflection; + + [Serializable] + public class SubViewController : Controller + { + public void Index() + { + } + + public void SubViewWithLayout() + { + this.LayoutName = "master"; + this.RenderView("index"); + } + + public void SubViewWithParameters() + { + this.RenderView("CallSubViewWithParameters"); + } + + public void SubViewWithPath() + { + } + + public void useLotsOfSubViews() + { + //this is ugly, but the other way is to open up things that really shouldn't be opened... + IViewEngineManager viewEngineManager = (IViewEngineManager)this.ServiceProvider.GetService(typeof(IViewEngineManager)); + MethodInfo method = viewEngineManager.GetType().GetMethod("ResolveEngine", BindingFlags.Instance|BindingFlags.NonPublic, null,new Type[] { typeof(string) },new ParameterModifier[0]); + IViewEngine engine1 = (IViewEngine)method.Invoke(viewEngineManager, new object[] { "dummy.brail" }); + Hashtable hashtable1 = (Hashtable)typeof(BooViewEngine).GetField("compilations", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(engine1); + Hashtable hashtable2 = (Hashtable)typeof(BooViewEngine).GetField("constructors", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(engine1); + if (this.Context.Request.QueryString["replaceSubView"] == "reset") + { + hashtable1[@"subview\listItem.brail"] = null; + } + else if (this.Context.Request.QueryString["replaceSubView"] == "true") + { + hashtable1[@"subview\listItem.brail"] = typeof(DummySubView); + Type[] typeArray1 = new Type[] { typeof(BooViewEngine), typeof(TextWriter), typeof(IRailsEngineContext), typeof(Controller) }; + hashtable2[typeof(DummySubView)] = typeof(DummySubView).GetConstructor(typeArray1); + } + } + + } +} + diff --git a/MonoRail/monorail.build b/MonoRail/monorail.build index baba9192c..9a4282faa 100644 --- a/MonoRail/monorail.build +++ b/MonoRail/monorail.build @@ -38,9 +38,9 @@ - + -- 2.11.4.GIT