2 using System.Collections.Generic;
3 using MonoTests.SystemWeb.Framework;
4 using MonoTests.stand_alone.WebHarness;
7 using System.Web.Compilation;
8 using System.Web.UI.WebControls;
9 using System.Reflection;
10 using System.ComponentModel;
11 using System.Threading;
13 namespace MonoTests.System.Web.Compilation {
14 public class ReadOnlyPropertyControl:TextBox {
24 public class BindTestDataItem
32 public BindTestDataItem (int data)
38 public class BindTestDataSource
40 public IList <BindTestDataItem> GetData ()
42 return new List <BindTestDataItem> {new BindTestDataItem (0), new BindTestDataItem (1)};
48 public class TemplateControlCompilerTest
51 public void TemplateControlCompiler_Init ()
53 WebTest.CopyResource (GetType (), "ReadOnlyPropertyBind.aspx", "ReadOnlyPropertyBind.aspx");
54 WebTest.CopyResource (GetType (), "ReadOnlyPropertyControl.ascx", "ReadOnlyPropertyControl.ascx");
55 WebTest.CopyResource (GetType (), "TemplateControlParsingTest.aspx", "TemplateControlParsingTest.aspx");
56 WebTest.CopyResource (GetType (), "ServerSideControlsInScriptBlock.aspx", "ServerSideControlsInScriptBlock.aspx");
58 WebTest.CopyResource (GetType (), "InvalidPropertyBind1.aspx", "InvalidPropertyBind1.aspx");
59 WebTest.CopyResource (GetType (), "InvalidPropertyBind2.aspx", "InvalidPropertyBind2.aspx");
60 WebTest.CopyResource (GetType (), "InvalidPropertyBind3.aspx", "InvalidPropertyBind3.aspx");
61 WebTest.CopyResource (GetType (), "InvalidPropertyBind4.aspx", "InvalidPropertyBind4.aspx");
62 WebTest.CopyResource (GetType (), "ValidPropertyBind1.aspx", "ValidPropertyBind1.aspx");
63 WebTest.CopyResource (GetType (), "ValidPropertyBind2.aspx", "ValidPropertyBind2.aspx");
64 WebTest.CopyResource (GetType (), "ValidPropertyBind3.aspx", "ValidPropertyBind3.aspx");
65 WebTest.CopyResource (GetType (), "ValidPropertyBind4.aspx", "ValidPropertyBind4.aspx");
66 WebTest.CopyResource (GetType (), "ValidPropertyBind5.aspx", "ValidPropertyBind5.aspx");
67 WebTest.CopyResource (GetType (), "NoBindForMethodsWithBindInName.aspx", "NoBindForMethodsWithBindInName.aspx");
68 WebTest.CopyResource (GetType (), "ReadWritePropertyControl.ascx", "ReadWritePropertyControl.ascx");
69 WebTest.CopyResource (GetType (), "ContentPlaceHolderInTemplate.aspx", "ContentPlaceHolderInTemplate.aspx");
70 WebTest.CopyResource (GetType (), "ContentPlaceHolderInTemplate.master", "ContentPlaceHolderInTemplate.master");
71 WebTest.CopyResource (GetType (), "LinkInHeadWithEmbeddedExpression.aspx", "LinkInHeadWithEmbeddedExpression.aspx");
72 WebTest.CopyResource (GetType (), "ExpressionInListControl.aspx", "ExpressionInListControl.aspx");
77 [NUnit.Framework.Category ("NunitWeb")]
79 [NUnit.Framework.Category ("NotWorking")]
81 public void ReadOnlyPropertyBindTest ()
83 new WebTest ("ReadOnlyPropertyBind.aspx").Run ();
87 // Test for bug #449970
89 public void MasterPageContentPlaceHolderInTemplate ()
91 new WebTest ("ContentPlaceHolderInTemplate.aspx").Run ();
95 [ExpectedException (typeof (CompilationException))]
96 public void InvalidPropertyBindTest1 ()
98 new WebTest ("InvalidPropertyBind1.aspx").Run ();
102 [ExpectedException (typeof (HttpParseException))]
103 public void InvalidPropertyBindTest2 ()
105 new WebTest ("InvalidPropertyBind2.aspx").Run ();
109 [ExpectedException (typeof (CompilationException))]
110 public void InvalidPropertyBindTest3 ()
112 new WebTest ("InvalidPropertyBind3.aspx").Run ();
116 [ExpectedException (typeof (HttpParseException))]
117 public void InvalidPropertyBindTest4 ()
119 new WebTest ("InvalidPropertyBind4.aspx").Run ();
123 public void ValidPropertyBindTest1 ()
125 new WebTest ("ValidPropertyBind1.aspx").Run ();
129 public void ValidPropertyBindTest2 ()
131 new WebTest ("ValidPropertyBind2.aspx").Run ();
135 public void ValidPropertyBindTest3 ()
137 new WebTest ("ValidPropertyBind3.aspx").Run ();
141 public void ValidPropertyBindTest4 ()
143 new WebTest ("ValidPropertyBind4.aspx").Run ();
147 public void ValidPropertyBindTest5 ()
149 new WebTest ("ValidPropertyBind5.aspx").Run ();
154 public void NoBindForMethodsWithBindInNameTest ()
156 string pageHtml = new WebTest ("NoBindForMethodsWithBindInName.aspx").Run ();
157 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
158 string originalHtml = "<span id=\"grid_ctl02_lblTest\">Test</span>";
160 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
165 public void LinkInHeadWithEmbeddedExpression ()
167 string pageHtml = new WebTest ("LinkInHeadWithEmbeddedExpression.aspx").Run ();
168 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
169 string originalHtml = "<link href=\"Themes/Default/Content/Site.css\" rel=\"stylesheet\" type=\"text/css\" />";
171 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
175 public void ExpressionInListControl ()
177 string pageHtml = new WebTest ("ExpressionInListControl.aspx").Run ();
178 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
179 string originalHtml = @"<select name=""DropDown1"" id=""DropDown1"">
180 <option value=""strvalue"">str</option>
183 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
186 [Test (Description="Bug #508888")]
187 public void ServerSideControlsInScriptBlock ()
189 string pageHtml = new WebTest ("ServerSideControlsInScriptBlock.aspx").Run ();
190 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
191 string originalHtml = @"<script type=""text/javascript"">alert (escape(""reporting/location?report=ViewsByDate&minDate=minDate&maxDate=maxDate""));</script>";
192 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
197 public void ChildTemplatesTest ()
200 WebTest.Host.AppDomain.AssemblyResolve += new ResolveEventHandler (ResolveAssemblyHandler);
201 new WebTest ("TemplateControlParsingTest.aspx").Run ();
203 WebTest.Host.AppDomain.AssemblyResolve -= new ResolveEventHandler (ResolveAssemblyHandler);
207 [TestFixtureTearDown]
208 public void TearDown ()
214 public static Assembly ResolveAssemblyHandler (object sender, ResolveEventArgs e)
216 if (e.Name != "System.Web_test")
219 return Assembly.GetExecutingAssembly ();