Hello Joel, In general, System.Web nunit tests should be put under: System.Web/Test/<relevant namespace>/<relevant class test fixture>.
Specifically, in case of MasterPage, you should add your test to: System.Web/Test/System.Web.UI.WebControls/MasterPageTest.cs. Tal Klar -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of joel reed Sent: Friday, September 15, 2006 9:05 PM To: mono-devel-list@lists.ximian.com Subject: Re: [Mono-dev] MasterType directive on Master Pages Ok, version 2 of the patch. Previously I was only compiling with PROFILE=net_2_0. Now it compiles for 1.1 and 2.0 profiles. jr joel reed wrote: > Mono (as of 9/14/06 snapshots) doesn't currently support the MasterType > directive on Master Pages, although it does support it on regular pages. > MS supports it both places. > > Please find attached a patch which implements support for this directive > for master pages as well. I've only submitted minor bug fixes to mono > before, so any feedback you can offer is appreciated. > > I will add a testcase as needed. Which directory should I put it in? > System.Web/Test/mainsoft? > > jr > > > ------------------------------------------------------------------------ > > diff --git a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs > index 89c8adf..07cc5c8 100644 > --- a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs > +++ b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs > @@ -225,7 +225,7 @@ namespace System.Web.Compilation > return new UserControlCompiler ((UserControlParser) tparser); > #if NET_2_0 > if (type == typeof(MasterPageParser)) > - return new UserControlCompiler ((UserControlParser) tparser); > + return new MasterPageCompiler ((MasterPageParser) tparser); > #endif > > throw new Exception ("Got type: " + type); > diff --git a/mcs/class/System.Web/System.Web.Compilation/MasterPageCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/MasterPageCompiler.cs > new file mode 100644 > index 0000000..02ad8c3 > --- /dev/null > +++ b/mcs/class/System.Web/System.Web.Compilation/MasterPageCompiler.cs > @@ -0,0 +1,64 @@ > +// > +// System.Web.Compilation.MasterPageCompiler > +// > +// Authors: > +// Joel W. Reed ([EMAIL PROTECTED]) > +// > +// > + > +// > +// Permission is hereby granted, free of charge, to any person obtaining > +// a copy of this software and associated documentation files (the > +// "Software"), to deal in the Software without restriction, including > +// without limitation the rights to use, copy, modify, merge, publish, > +// distribute, sublicense, and/or sell copies of the Software, and to > +// permit persons to whom the Software is furnished to do so, subject to > +// the following conditions: > +// > +// The above copyright notice and this permission notice shall be > +// included in all copies or substantial portions of the Software. > +// > +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND > +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE > +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION > +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION > +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > +// > +using System; > +using System.CodeDom; > +using System.Web.UI; > + > +namespace System.Web.Compilation > +{ > + class MasterPageCompiler : UserControlCompiler > + { > + MasterPageParser parser; > + > + public MasterPageCompiler (MasterPageParser parser) > + : base (parser) > + { > + this.parser = parser; > + } > + > + protected internal override void CreateMethods () > + { > + base.CreateMethods (); > + > +#if NET_2_0 > + if (parser.MasterType != null) { > + CodeMemberProperty mprop = new CodeMemberProperty (); > + mprop.Name = "Master"; > + mprop.Type = new CodeTypeReference (parser.MasterType); > + mprop.Attributes = MemberAttributes.Public | MemberAttributes.New; > + CodeExpression prop = new CodePropertyReferenceExpression (new CodeBaseReferenceExpression (), "Master"); > + prop = new CodeCastExpression (parser.MasterType, prop); > + mprop.GetStatements.Add (new CodeMethodReturnStatement (prop)); > + mainClass.Members.Add (mprop); > + } > +#endif > + } > + } > +} > + > diff --git a/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs b/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs > index 1e6440f..b115473 100644 > --- a/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs > +++ b/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs > @@ -41,6 +41,8 @@ namespace System.Web.UI > { > internal sealed class MasterPageParser: UserControlParser > { > + Type masterType; > + > internal MasterPageParser (string virtualPath, string inputFile, HttpContext context) > : base (virtualPath, inputFile, context, "System.Web.UI.MasterPage") > { > @@ -57,7 +59,6 @@ namespace System.Web.UI > MasterPageParser mpp = new MasterPageParser (virtualPath, inputFile, context); > return mpp.CompileIntoType (); > } > - > internal override void HandleOptions (object obj) > { > base.HandleOptions (obj); > @@ -66,6 +67,32 @@ namespace System.Web.UI > mp.MasterPageFile = MasterPageFile; > } > > +#if NET_2_0 > + internal override void AddDirective (string directive, Hashtable atts) > + { > + if (String.Compare ("MasterType", directive, true) == 0) { > + string type = GetString (atts, "TypeName", null); > + if (type != null) { > + masterType = LoadType (type); > + if (masterType == null) > + ThrowParseException ("Could not load type '" + type + "'."); > + } else { > + string path = GetString (atts, "VirtualPath", null); > + if (path != null) > + masterType = MasterPageParser.GetCompiledMasterType (path, MapPath (path), HttpContext.Current); > + else > + ThrowParseException ("The MasterType directive must have either a TypeName or a VirtualPath attribute."); } > + AddAssembly (masterType.Assembly, true); > + } > + else > + base.AddDirective (directive, atts); > + } > +#endif > + > + internal Type MasterType { > + get { return masterType; } > + } > + > internal override Type DefaultBaseType { > get { return typeof (MasterPage); } > } > diff --git a/mcs/class/System.Web/System.Web.dll.sources b/mcs/class/System.Web/System.Web.dll.sources > index a68b69b..700dfaf 100644 > --- a/mcs/class/System.Web/System.Web.dll.sources > +++ b/mcs/class/System.Web/System.Web.dll.sources > @@ -51,6 +51,7 @@ System.Web.Compilation/ImplicitResourceK > System.Web.Compilation/IResourceProvider.cs > System.Web.Compilation/LinePragmaCodeInfo.cs > System.Web.Compilation/Location.cs > +System.Web.Compilation/MasterPageCompiler.cs > System.Web.Compilation/PageBuildProvider.cs > System.Web.Compilation/PageCompiler.cs > System.Web.Compilation/PageThemeCompiler.cs > > > ------------------------------------------------------------------------ > > _______________________________________________ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list