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");
58 WebTest.CopyResource (GetType (), "UnquotedAngleBrackets.aspx", "UnquotedAngleBrackets.aspx");
59 WebTest.CopyResource (GetType (), "FullTagsInText.aspx", "FullTagsInText.aspx");
60 WebTest.CopyResource (GetType (), "TagsExpressionsAndCommentsInText.aspx", "TagsExpressionsAndCommentsInText.aspx");
61 WebTest.CopyResource (GetType (), "NewlineInCodeExpression.aspx", "NewlineInCodeExpression.aspx");
62 WebTest.CopyResource (GetType (), "DuplicateControlsInClientComment.aspx", "DuplicateControlsInClientComment.aspx");
63 WebTest.CopyResource (GetType (), "TagsNestedInClientTag.aspx", "TagsNestedInClientTag.aspx");
64 WebTest.CopyResource (GetType (), "ConditionalClientComments.aspx", "ConditionalClientComments.aspx");
66 WebTest.CopyResource (GetType (), "InvalidPropertyBind1.aspx", "InvalidPropertyBind1.aspx");
67 WebTest.CopyResource (GetType (), "InvalidPropertyBind2.aspx", "InvalidPropertyBind2.aspx");
68 WebTest.CopyResource (GetType (), "InvalidPropertyBind3.aspx", "InvalidPropertyBind3.aspx");
69 WebTest.CopyResource (GetType (), "InvalidPropertyBind4.aspx", "InvalidPropertyBind4.aspx");
70 WebTest.CopyResource (GetType (), "ValidPropertyBind1.aspx", "ValidPropertyBind1.aspx");
71 WebTest.CopyResource (GetType (), "ValidPropertyBind2.aspx", "ValidPropertyBind2.aspx");
72 WebTest.CopyResource (GetType (), "ValidPropertyBind3.aspx", "ValidPropertyBind3.aspx");
73 WebTest.CopyResource (GetType (), "ValidPropertyBind4.aspx", "ValidPropertyBind4.aspx");
74 WebTest.CopyResource (GetType (), "ValidPropertyBind5.aspx", "ValidPropertyBind5.aspx");
75 WebTest.CopyResource (GetType (), "NoBindForMethodsWithBindInName.aspx", "NoBindForMethodsWithBindInName.aspx");
76 WebTest.CopyResource (GetType (), "ReadWritePropertyControl.ascx", "ReadWritePropertyControl.ascx");
77 WebTest.CopyResource (GetType (), "ContentPlaceHolderInTemplate.aspx", "ContentPlaceHolderInTemplate.aspx");
78 WebTest.CopyResource (GetType (), "ContentPlaceHolderInTemplate.master", "ContentPlaceHolderInTemplate.master");
79 WebTest.CopyResource (GetType (), "LinkInHeadWithEmbeddedExpression.aspx", "LinkInHeadWithEmbeddedExpression.aspx");
80 WebTest.CopyResource (GetType (), "ExpressionInListControl.aspx", "ExpressionInListControl.aspx");
81 WebTest.CopyResource (GetType (), "PreprocessorDirectivesInMarkup.aspx", "PreprocessorDirectivesInMarkup.aspx");
82 WebTest.CopyResource (GetType (), "OneLetterIdentifierInCodeRender.aspx", "OneLetterIdentifierInCodeRender.aspx");
83 WebTest.CopyResource (GetType (), "NestedParserFileText.aspx", "NestedParserFileText.aspx");
84 WebTest.CopyResource (GetType (), "TagWithExpressionWithinAttribute.aspx", "TagWithExpressionWithinAttribute.aspx");
89 [NUnit.Framework.Category ("NunitWeb")]
91 [NUnit.Framework.Category ("NotWorking")]
93 public void ReadOnlyPropertyBindTest ()
95 new WebTest ("ReadOnlyPropertyBind.aspx").Run ();
99 // Test for bug #449970
101 public void MasterPageContentPlaceHolderInTemplate ()
103 new WebTest ("ContentPlaceHolderInTemplate.aspx").Run ();
107 [ExpectedException ("System.Web.Compilation.CompilationException")]
108 public void InvalidPropertyBindTest1 ()
110 new WebTest ("InvalidPropertyBind1.aspx").Run ();
114 [ExpectedException (typeof (HttpParseException))]
115 public void InvalidPropertyBindTest2 ()
117 new WebTest ("InvalidPropertyBind2.aspx").Run ();
121 [ExpectedException ("System.Web.Compilation.CompilationException")]
122 public void InvalidPropertyBindTest3 ()
124 new WebTest ("InvalidPropertyBind3.aspx").Run ();
128 [ExpectedException (typeof (HttpParseException))]
129 public void InvalidPropertyBindTest4 ()
131 new WebTest ("InvalidPropertyBind4.aspx").Run ();
135 public void ValidPropertyBindTest1 ()
137 new WebTest ("ValidPropertyBind1.aspx").Run ();
141 public void ValidPropertyBindTest2 ()
143 new WebTest ("ValidPropertyBind2.aspx").Run ();
147 public void ValidPropertyBindTest3 ()
149 new WebTest ("ValidPropertyBind3.aspx").Run ();
153 public void ValidPropertyBindTest4 ()
155 new WebTest ("ValidPropertyBind4.aspx").Run ();
159 public void ValidPropertyBindTest5 ()
161 new WebTest ("ValidPropertyBind5.aspx").Run ();
166 public void NoBindForMethodsWithBindInNameTest ()
168 string pageHtml = new WebTest ("NoBindForMethodsWithBindInName.aspx").Run ();
169 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
170 string originalHtml = "<span id=\"grid_ctl02_lblTest\">Test</span>";
172 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
177 public void LinkInHeadWithEmbeddedExpression ()
179 string pageHtml = new WebTest ("LinkInHeadWithEmbeddedExpression.aspx").Run ();
180 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
181 string originalHtml = "<link href=\"Themes/Default/Content/Site.css\" rel=\"stylesheet\" type=\"text/css\" />";
183 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
187 public void ExpressionInListControl ()
189 string pageHtml = new WebTest ("ExpressionInListControl.aspx").Run ();
190 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
191 string originalHtml = @"<select name=""DropDown1"" id=""DropDown1"">
192 <option value=""strvalue"">str</option>
195 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
198 [Test (Description="Bug #508888")]
199 public void ServerSideControlsInScriptBlock ()
201 string pageHtml = new WebTest ("ServerSideControlsInScriptBlock.aspx").Run ();
202 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
203 string originalHtml = @"<script type=""text/javascript"">alert (escape(""reporting/location?report=ViewsByDate&minDate=minDate&maxDate=maxDate""));</script>";
204 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
207 [Test (Description="Bug #520024")]
208 public void PreprocessorDirectivesInMarkup ()
210 // Just test if it doesn't throw an exception
211 new WebTest ("PreprocessorDirectivesInMarkup.aspx").Run ();
214 [Test (Description="Bug #526449")]
215 public void NewlineInCodeExpression ()
217 string pageHtml = new WebTest ("NewlineInCodeExpression.aspx").Run ();
218 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
219 string originalHtml = "<a href=\"test\">bla</a>";
220 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
223 [Test (Description="Bug #524358")]
224 [ExpectedException ("System.Web.Compilation.ParseException")]
225 public void DuplicateControlsInClientComment ()
227 // Just test if it throws an exception
228 new WebTest ("DuplicateControlsInClientComment.aspx").Run ();
231 [Test (Description="Bug #367723")]
232 public void ConditionalClientComments ()
234 string pageHtml = new WebTest ("ConditionalClientComments.aspx").Run ();
235 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
236 string originalHtml = @"<!--[if IE 6]>
237 <link rel=""styleheet"" type=""text/css"" href=""compat-ie6.css"" />
239 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
242 [Test (Description="Bug #400807")]
243 public void OneLetterIdentifierInCodeRender ()
245 string pageHtml = new WebTest ("OneLetterIdentifierInCodeRender.aspx").Run ();
246 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
247 string originalHtml = @"bDoR called";
249 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
252 [Test (Description="Bug #562286")]
253 public void NestedParserFileText ()
255 // Just test if it doesn't throw an exception
256 new WebTest ("NestedParserFileText.aspx").Run ();
259 [Test (Description="Bug #568631")]
260 public void TagWithExpressionWithinAttribute ()
262 // Just test if it doesn't throw an exception
263 new WebTest ("TagWithExpressionWithinAttribute.aspx").Run ();
266 [Test (Description="Bug #323719")]
267 public void TagsNestedInClientTag ()
269 string pageHtml = new WebTest ("TagsNestedInClientTag.aspx").Run ();
270 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
271 string originalHtml = @"<script language=""javascript"" src=""/js/test.js"" type=""text/javascript""></script>
272 <sometag language=""javascript"" src=""/js/test.js"" type=""text/javascript""></sometag>";
274 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
277 [Test (Description="Bug #517656")]
278 public void ServerControlInClientSideComment ()
280 string pageHtml = new WebTest ("ServerControlInClientSideComment.aspx").Run ();
281 string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
282 string originalHtml = @"<!-- comment start
283 <input id=""testBox"" type=""checkbox"" name=""testBox"" />
285 HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
289 public void UnquotedAngleBrackets ()
291 // We just test if it doesn't throw an exception
292 new WebTest ("UnquotedAngleBrackets.aspx").Run ();
296 public void FullTagsInText ()
298 // We just test if it doesn't throw an exception
299 new WebTest ("FullTagsInText.aspx").Run ();
303 public void TagsExpressionsAndCommentsInText ()
305 // We just test if it doesn't throw an exception
306 new WebTest ("TagsExpressionsAndCommentsInText.aspx").Run ();
310 public void ChildTemplatesTest ()
313 WebTest.Host.AppDomain.AssemblyResolve += new ResolveEventHandler (ResolveAssemblyHandler);
314 new WebTest ("TemplateControlParsingTest.aspx").Run ();
316 WebTest.Host.AppDomain.AssemblyResolve -= new ResolveEventHandler (ResolveAssemblyHandler);
320 [TestFixtureTearDown]
321 public void TearDown ()
327 public static Assembly ResolveAssemblyHandler (object sender, ResolveEventArgs e)
329 if (e.Name != "System.Web_test")
332 return Assembly.GetExecutingAssembly ();