Files
mono/mcs/class/System.Web/Test/System.Web.Compilation/TemplateControlCompilerTest.cs
T
Marek Habersack a77d9eca19 2008-11-21 Marek Habersack <[email protected]>
* CompilationException.cs: made serializable.

	* TemplateControlCompiler.cs: make the Bind regex stricter.
	When creating Eval expression from Bind, replace single quotes
	with double quotes. Fixes bug #447597
	When processing Bind expressions and the regex doesn't match,
	throw an exception.

2008-11-21  Marek Habersack  <[email protected]>

	* Makefile (TEST_RESOURCE_FILES): added
	Test/mainsoft/NunitWebResources/InvalidPropertyBind1.aspx
	Test/mainsoft/NunitWebResources/InvalidPropertyBind2.aspx
	Test/mainsoft/NunitWebResources/InvalidPropertyBind3.aspx
	Test/mainsoft/NunitWebResources/InvalidPropertyBind4.aspx
	Test/mainsoft/NunitWebResources/ValidPropertyBind1.aspx
	Test/mainsoft/NunitWebResources/ValidPropertyBind2.aspx
	Test/mainsoft/NunitWebResources/ValidPropertyBind3.aspx
	Test/mainsoft/NunitWebResources/ValidPropertyBind4.aspx
	Test/mainsoft/NunitWebResources/ReadWritePropertyControl.ascx

	* Test/tools/web.config: disabled batch compilation and enabled
	debugging.

2008-11-21  Marek Habersack  <[email protected]>

	* HttpParseException.cs, HtmlizedException.cs: added
	deserialization constructor.

2008-11-21  Marek Habersack  <[email protected]>

	* TemplateControlCompilerTest.cs: added simple data source for
	Bind tests.
	Added 8 tests for valid and invalid Bind expressions.

2008-11-21  Marek Habersack  <[email protected]>

	* Web.config, Web.mono.config: disabled batch compilation.

2008-11-21  Marek Habersack  <[email protected]>

	* NunitWebResources/WebLogin.config,
	NunitWebResources/WebControl.config: disabled batch compilation.

	* NunitWebResources/WebMapping.config: enabled debugging and
	disabled batch compilation.

	* NunitWebResources/InvalidPropertyBind1.aspx,
	NunitWebResources/InvalidPropertyBind2.aspx,
	NunitWebResources/InvalidPropertyBind3.aspx,
	NunitWebResources/InvalidPropertyBind4.aspx,
	NunitWebResources/ValidPropertyBind1.aspx,
	NunitWebResources/ValidPropertyBind2.aspx,
	NunitWebResources/ValidPropertyBind3.aspx,
	NunitWebResources/ValidPropertyBind4.aspx,
	NunitWebResources/ReadWritePropertyControl.ascx: added

	* MainsoftWebApp20/Web.config: disabled batch compilation

2008-11-21  Marek Habersack  <[email protected]>

	* Web.config: disabled batch compilation



svn path=/trunk/mcs/; revision=119673
2008-11-21 21:35:55 +00:00

160 lines
4.0 KiB
C#

using System;
using System.Collections.Generic;
using MonoTests.SystemWeb.Framework;
using NUnit.Framework;
using System.Web;
using System.Web.Compilation;
using System.Web.UI.WebControls;
using System.Reflection;
using System.ComponentModel;
using System.Threading;
namespace MonoTests.System.Web.Compilation {
public class ReadOnlyPropertyControl:TextBox {
[Bindable (true)]
public bool MyProp
{
get { return true; }
}
}
#if NET_2_0
public class BindTestDataItem
{
int data;
public int Data {
get { return data; }
set { data = value; }
}
public BindTestDataItem (int data)
{
this.data = data;
}
}
public class BindTestDataSource
{
public IList <BindTestDataItem> GetData ()
{
return new List <BindTestDataItem> {new BindTestDataItem (0), new BindTestDataItem (1)};
}
}
#endif
[TestFixture]
public class TemplateControlCompilerTest
{
[TestFixtureSetUp]
public void TemplateControlCompiler_Init ()
{
WebTest.CopyResource (GetType (), "ReadOnlyPropertyBind.aspx", "ReadOnlyPropertyBind.aspx");
WebTest.CopyResource (GetType (), "ReadOnlyPropertyControl.ascx", "ReadOnlyPropertyControl.ascx");
WebTest.CopyResource (GetType (), "TemplateControlParsingTest.aspx", "TemplateControlParsingTest.aspx");
#if NET_2_0
WebTest.CopyResource (GetType (), "InvalidPropertyBind1.aspx", "InvalidPropertyBind1.aspx");
WebTest.CopyResource (GetType (), "InvalidPropertyBind2.aspx", "InvalidPropertyBind2.aspx");
WebTest.CopyResource (GetType (), "InvalidPropertyBind3.aspx", "InvalidPropertyBind3.aspx");
WebTest.CopyResource (GetType (), "InvalidPropertyBind4.aspx", "InvalidPropertyBind4.aspx");
WebTest.CopyResource (GetType (), "ValidPropertyBind1.aspx", "ValidPropertyBind1.aspx");
WebTest.CopyResource (GetType (), "ValidPropertyBind2.aspx", "ValidPropertyBind2.aspx");
WebTest.CopyResource (GetType (), "ValidPropertyBind3.aspx", "ValidPropertyBind3.aspx");
WebTest.CopyResource (GetType (), "ValidPropertyBind4.aspx", "ValidPropertyBind4.aspx");
WebTest.CopyResource (GetType (), "ReadWritePropertyControl.ascx", "ReadWritePropertyControl.ascx");
#endif
}
[Test]
[NUnit.Framework.Category ("NunitWeb")]
#if !TARGET_JVM
[NUnit.Framework.Category ("NotWorking")]
#endif
public void ReadOnlyPropertyBindTest ()
{
new WebTest ("ReadOnlyPropertyBind.aspx").Run ();
}
#if NET_2_0
[Test]
[ExpectedException (typeof (CompilationException))]
public void InvalidPropertyBindTest1 ()
{
new WebTest ("InvalidPropertyBind1.aspx").Run ();
}
[Test]
[ExpectedException (typeof (HttpParseException))]
public void InvalidPropertyBindTest2 ()
{
new WebTest ("InvalidPropertyBind2.aspx").Run ();
}
[Test]
[ExpectedException (typeof (CompilationException))]
public void InvalidPropertyBindTest3 ()
{
new WebTest ("InvalidPropertyBind3.aspx").Run ();
}
[Test]
[ExpectedException (typeof (HttpParseException))]
public void InvalidPropertyBindTest4 ()
{
new WebTest ("InvalidPropertyBind4.aspx").Run ();
}
[Test]
public void ValidPropertyBindTest1 ()
{
new WebTest ("ValidPropertyBind1.aspx").Run ();
}
[Test]
public void ValidPropertyBindTest2 ()
{
new WebTest ("ValidPropertyBind2.aspx").Run ();
}
[Test]
public void ValidPropertyBindTest3 ()
{
new WebTest ("ValidPropertyBind3.aspx").Run ();
}
[Test]
public void ValidPropertyBindTest4 ()
{
new WebTest ("ValidPropertyBind4.aspx").Run ();
}
#endif
[Test]
public void ChildTemplatesTest ()
{
try {
WebTest.Host.AppDomain.AssemblyResolve += new ResolveEventHandler (ResolveAssemblyHandler);
new WebTest ("TemplateControlParsingTest.aspx").Run ();
} finally {
WebTest.Host.AppDomain.AssemblyResolve -= new ResolveEventHandler (ResolveAssemblyHandler);
}
}
[TestFixtureTearDown]
public void TearDown ()
{
Thread.Sleep (100);
WebTest.Unload ();
}
public static Assembly ResolveAssemblyHandler (object sender, ResolveEventArgs e)
{
if (e.Name != "System.Web_test")
return null;
return Assembly.GetExecutingAssembly ();
}
}
}