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");
57 WebTest.CopyResource (GetType (), "ServerControlInClientSideComment.aspx", "ServerControlInClientSideComment.aspx");
59 WebTest.CopyResource (GetType (), "InvalidPropertyBind1.aspx", "InvalidPropertyBind1.aspx");
60 WebTest.CopyResource (GetType (), "InvalidPropertyBind2.aspx", "InvalidPropertyBind2.aspx");
61 WebTest.CopyResource (GetType (), "InvalidPropertyBind3.aspx", "InvalidPropertyBind3.aspx");
62 WebTest.CopyResource (GetType (), "InvalidPropertyBind4.aspx", "InvalidPropertyBind4.aspx");
63 WebTest.CopyResource (GetType (), "ValidPropertyBind1.aspx", "ValidPropertyBind1.aspx");
64 WebTest.CopyResource (GetType (), "ValidPropertyBind2.aspx", "ValidPropertyBind2.aspx");
65 WebTest.CopyResource (GetType (), "ValidPropertyBind3.aspx", "ValidPropertyBind3.aspx");
66 WebTest.CopyResource (GetType (), "ValidPropertyBind4.aspx", "ValidPropertyBind4.aspx");
67 WebTest.CopyResource (GetType (), "ValidPropertyBind5.aspx", "ValidPropertyBind5.aspx");
68 WebTest.CopyResource (GetType (), "NoBindForMethodsWithBindInName.aspx", "NoBindForMethodsWithBindInName.aspx");
69 WebTest.CopyResource (GetType (), "ReadWritePropertyControl.ascx", "ReadWritePropertyControl.ascx");
70 WebTest.CopyResource (GetType (), "ContentPlaceHolderInTemplate.aspx", "ContentPlaceHolderInTemplate.aspx");
71 WebTest.CopyResource (GetType (), "ContentPlaceHolderInTemplate.master", "ContentPlaceHolderInTemplate.master");
72 WebTest.CopyResource (GetType (), "LinkInHeadWithEmbeddedExpression.aspx", "LinkInHeadWithEmbeddedExpression.aspx");
73 WebTest.CopyResource (GetType (), "ExpressionInListControl.aspx", "ExpressionInListControl.aspx");
74 WebTest.CopyResource (GetType (), "PreprocessorDirectivesInMarkup.aspx", "PreprocessorDirectivesInMarkup.aspx");
79 [NUnit.Framework.Category ("NunitWeb")]
81 [NUnit.Framework.Category ("NotWorking")]
83 public void ReadOnlyPropertyBindTest ()
85 new WebTest ("ReadOnlyPropertyBind.aspx").Run ();
89 // Test for bug #449970
91 public void MasterPageContentPlaceHolderInTemplate ()
93 new WebTest ("ContentPlaceHolderInTemplate.aspx").Run ();
97 [ExpectedException ("System.Web.Compilation.CompilationException")]
98 public void InvalidPropertyBindTest1 ()
100 new WebTest ("InvalidPropertyBind1.aspx").Run ();
104 [ExpectedException (typeof (HttpParseException))]
105 public void InvalidPropertyBindTest2 ()
107 new WebTest ("InvalidPropertyBind2.aspx").Run ();
111 [ExpectedException ("System.Web.Compilation.CompilationException")]
112 public void InvalidPropertyBindTest3 ()
114 new WebTest ("InvalidPropertyBind3.aspx").Run ();
118 [ExpectedException (typeof (HttpParseException))]
119 public void InvalidPropertyBindTest4 ()
121 new WebTest ("InvalidPropertyBind4.aspx").Run ();
125 public void ValidPropertyBindTest1 ()
127 new WebTest ("ValidPropertyBind1.aspx").Run ();
131 public void ValidPropertyBindTest2 ()
133 new WebTest ("ValidPropertyBind2.aspx").Run ();
137 public void ValidPropertyBindTest3 ()
139 new WebTest ("ValidPropertyBind3.aspx").Run ();
143 public void ValidPropertyBindTest4 ()
145 new WebTest ("ValidPropertyBind4.aspx").Run ();
149 public void ValidPropertyBindTest5 ()
151 new WebTest ("ValidPropertyBind5.aspx").Run ();
156 public void NoBindForMethodsWithBindInNameTest ()
158 string pageHtml = new WebTest ("NoBindForMethodsWithBindInName.aspx").Run ();
159 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
160 string originalHtml = "<span id=\"grid_ctl02_lblTest\">Test</span>";
162 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
167 public void LinkInHeadWithEmbeddedExpression ()
169 string pageHtml = new WebTest ("LinkInHeadWithEmbeddedExpression.aspx").Run ();
170 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
171 string originalHtml = "<link href=\"Themes/Default/Content/Site.css\" rel=\"stylesheet\" type=\"text/css\" />";
173 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
177 public void ExpressionInListControl ()
179 string pageHtml = new WebTest ("ExpressionInListControl.aspx").Run ();
180 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
181 string originalHtml = @"<select name=""DropDown1"" id=""DropDown1"">
182 <option value=""strvalue"">str</option>
185 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
188 [Test (Description="Bug #508888")]
189 public void ServerSideControlsInScriptBlock ()
191 string pageHtml = new WebTest ("ServerSideControlsInScriptBlock.aspx").Run ();
192 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
193 string originalHtml = @"<script type=""text/javascript"">alert (escape(""reporting/location?report=ViewsByDate&minDate=minDate&maxDate=maxDate""));</script>";
194 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
197 [Test (Description="Bug #520024")]
198 public void PreprocessorDirectivesInMarkup ()
200 // Just test if it doesn't throw an exception
201 new WebTest ("PreprocessorDirectivesInMarkup.aspx").Run ();
205 [Test (Description="Bug #517656")]
206 public void ServerControlInClientSideComment ()
208 // We just test if it doesn't throw an exception
209 new WebTest ("ServerControlInClientSideComment.aspx").Run ();
213 public void ChildTemplatesTest ()
216 WebTest.Host.AppDomain.AssemblyResolve += new ResolveEventHandler (ResolveAssemblyHandler);
217 new WebTest ("TemplateControlParsingTest.aspx").Run ();
219 WebTest.Host.AppDomain.AssemblyResolve -= new ResolveEventHandler (ResolveAssemblyHandler);
223 [TestFixtureTearDown]
224 public void TearDown ()
230 public static Assembly ResolveAssemblyHandler (object sender, ResolveEventArgs e)
232 if (e.Name != "System.Web_test")
235 return Assembly.GetExecutingAssembly ();