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");
85 WebTest
.CopyResource (GetType (), "EnumConverter_Bug578586.aspx", "EnumConverter_Bug578586.aspx");
90 [NUnit
.Framework
.Category ("NunitWeb")]
91 [NUnit
.Framework
.Category ("NotWorking")]
92 public void ReadOnlyPropertyBindTest ()
94 new WebTest ("ReadOnlyPropertyBind.aspx").Run ();
98 // Test for bug #449970
100 public void MasterPageContentPlaceHolderInTemplate ()
102 new WebTest ("ContentPlaceHolderInTemplate.aspx").Run ();
106 [ExpectedException ("System.Web.Compilation.CompilationException")]
107 public void InvalidPropertyBindTest1 ()
109 new WebTest ("InvalidPropertyBind1.aspx").Run ();
113 [ExpectedException (typeof (HttpParseException
))]
114 public void InvalidPropertyBindTest2 ()
116 new WebTest ("InvalidPropertyBind2.aspx").Run ();
120 [ExpectedException ("System.Web.Compilation.CompilationException")]
121 public void InvalidPropertyBindTest3 ()
123 new WebTest ("InvalidPropertyBind3.aspx").Run ();
127 [ExpectedException (typeof (HttpParseException
))]
128 public void InvalidPropertyBindTest4 ()
130 new WebTest ("InvalidPropertyBind4.aspx").Run ();
134 public void ValidPropertyBindTest1 ()
136 new WebTest ("ValidPropertyBind1.aspx").Run ();
140 public void ValidPropertyBindTest2 ()
142 new WebTest ("ValidPropertyBind2.aspx").Run ();
146 public void ValidPropertyBindTest3 ()
148 new WebTest ("ValidPropertyBind3.aspx").Run ();
152 public void ValidPropertyBindTest4 ()
154 new WebTest ("ValidPropertyBind4.aspx").Run ();
158 public void ValidPropertyBindTest5 ()
160 new WebTest ("ValidPropertyBind5.aspx").Run ();
165 public void NoBindForMethodsWithBindInNameTest ()
167 string pageHtml
= new WebTest ("NoBindForMethodsWithBindInName.aspx").Run ();
168 string renderedHtml
= HtmlDiff
.GetControlFromPageHtml (pageHtml
);
169 string originalHtml
= "<span id=\"grid_ctl02_lblTest\">Test</span>";
171 HtmlDiff
.AssertAreEqual (originalHtml
, renderedHtml
, "#A1");
176 public void LinkInHeadWithEmbeddedExpression ()
178 string pageHtml
= new WebTest ("LinkInHeadWithEmbeddedExpression.aspx").Run ();
179 string renderedHtml
= HtmlDiff
.GetControlFromPageHtml (pageHtml
);
180 string originalHtml
= "<link href=\"Themes/Default/Content/Site.css\" rel=\"stylesheet\" type=\"text/css\" />";
182 HtmlDiff
.AssertAreEqual (originalHtml
, renderedHtml
, "#A1");
186 public void ExpressionInListControl ()
188 string pageHtml
= new WebTest ("ExpressionInListControl.aspx").Run ();
189 string renderedHtml
= HtmlDiff
.GetControlFromPageHtml (pageHtml
);
190 string originalHtml
= @"<select name=""DropDown1"" id=""DropDown1"">
191 <option value=""strvalue"">str</option>
194 HtmlDiff
.AssertAreEqual (originalHtml
, renderedHtml
, "#A1");
197 [Test (Description
="Bug #508888")]
198 public void ServerSideControlsInScriptBlock ()
200 string pageHtml
= new WebTest ("ServerSideControlsInScriptBlock.aspx").Run ();
201 string renderedHtml
= HtmlDiff
.GetControlFromPageHtml (pageHtml
);
202 string originalHtml
= @"<script type=""text/javascript"">alert (escape(""reporting/location?report=ViewsByDate&minDate=minDate&maxDate=maxDate""));</script>";
203 HtmlDiff
.AssertAreEqual (originalHtml
, renderedHtml
, "#A1");
206 [Test (Description
="Bug #520024")]
207 public void PreprocessorDirectivesInMarkup ()
209 // Just test if it doesn't throw an exception
210 new WebTest ("PreprocessorDirectivesInMarkup.aspx").Run ();
213 [Test (Description
="Bug #526449")]
214 public void NewlineInCodeExpression ()
216 string pageHtml
= new WebTest ("NewlineInCodeExpression.aspx").Run ();
217 string renderedHtml
= HtmlDiff
.GetControlFromPageHtml (pageHtml
);
218 string originalHtml
= "<a href=\"test\">bla</a>";
219 HtmlDiff
.AssertAreEqual (originalHtml
, renderedHtml
, "#A1");
222 [Test (Description
="Bug #524358")]
223 public void DuplicateControlsInClientComment ()
225 // Just test if it throws an exception
226 string pageHtml
= new WebTest ("DuplicateControlsInClientComment.aspx").Run ();
227 Assert
.IsTrue (pageHtml
.IndexOf ("[System.Web.Compilation.ParseException]:") != -1, "#A1");
230 [Test (Description
="Bug #367723")]
231 public void ConditionalClientComments ()
233 string pageHtml
= new WebTest ("ConditionalClientComments.aspx").Run ();
234 string renderedHtml
= HtmlDiff
.GetControlFromPageHtml (pageHtml
);
235 string originalHtml
= @"<!--[if IE 6]>
236 <link rel=""styleheet"" type=""text/css"" href=""~/compat-ie6.css""></link>
238 HtmlDiff
.AssertAreEqual (originalHtml
, renderedHtml
, "#A1");
241 [Test (Description
="Bug #400807")]
242 public void OneLetterIdentifierInCodeRender ()
244 string pageHtml
= new WebTest ("OneLetterIdentifierInCodeRender.aspx").Run ();
245 string renderedHtml
= HtmlDiff
.GetControlFromPageHtml (pageHtml
);
246 string originalHtml
= @"bDoR called";
248 HtmlDiff
.AssertAreEqual (originalHtml
, renderedHtml
, "#A1");
251 [Test (Description
="Bug #562286")]
252 public void NestedParserFileText ()
254 // Just test if it doesn't throw an exception
255 new WebTest ("NestedParserFileText.aspx").Run ();
258 [Test (Description
="Bug #568631")]
259 public void TagWithExpressionWithinAttribute ()
261 // Just test if it doesn't throw an exception
262 new WebTest ("TagWithExpressionWithinAttribute.aspx").Run ();
265 [Test (Description
="Bug #578586")]
266 public void EnumConverter_Bug578586 ()
268 WebTest t
= new WebTest ("EnumConverter_Bug578586.aspx");
269 string pageHtml
= t
.Run ();
270 string renderedHtml
= HtmlDiff
.GetControlFromPageHtml (pageHtml
);
271 string originalHtml
= @"<input type=""text"" value=""FlagOne"" name=""test"" id=""test"" />";
273 HtmlDiff
.AssertAreEqual (originalHtml
, renderedHtml
, "#A1");
276 [Test (Description
="Bug #323719")]
277 public void TagsNestedInClientTag ()
279 string pageHtml
= new WebTest ("TagsNestedInClientTag.aspx").Run ();
280 string renderedHtml
= HtmlDiff
.GetControlFromPageHtml (pageHtml
);
281 string originalHtml
= @"<script language=""javascript"" src=""/js/test.js"" type=""text/javascript""></script>
282 <sometag language=""javascript"" src=""/js/test.js"" type=""text/javascript""></sometag>";
284 HtmlDiff
.AssertAreEqual (originalHtml
, renderedHtml
, "#A1");
287 [Test (Description
="Bug #517656")]
288 public void ServerControlInClientSideComment ()
290 string pageHtml
= new WebTest ("ServerControlInClientSideComment.aspx").Run ();
291 string renderedHtml
= HtmlDiff
.GetControlFromPageHtml (pageHtml
);
292 string originalHtml
= @"<!-- comment start
293 <input id=""testBox"" type=""checkbox"" name=""testBox"" />
295 HtmlDiff
.AssertAreEqual (originalHtml
, renderedHtml
, "#A1");
299 public void UnquotedAngleBrackets ()
301 // We just test if it doesn't throw an exception
302 new WebTest ("UnquotedAngleBrackets.aspx").Run ();
306 public void FullTagsInText ()
308 // We just test if it doesn't throw an exception
309 new WebTest ("FullTagsInText.aspx").Run ();
313 public void TagsExpressionsAndCommentsInText ()
315 // We just test if it doesn't throw an exception
316 new WebTest ("TagsExpressionsAndCommentsInText.aspx").Run ();
320 public void ChildTemplatesTest ()
323 WebTest
.Host
.AppDomain
.AssemblyResolve
+= new ResolveEventHandler (ResolveAssemblyHandler
);
324 new WebTest ("TemplateControlParsingTest.aspx").Run ();
326 WebTest
.Host
.AppDomain
.AssemblyResolve
-= new ResolveEventHandler (ResolveAssemblyHandler
);
330 [TestFixtureTearDown
]
331 public void TearDown ()
337 public static Assembly
ResolveAssemblyHandler (object sender
, ResolveEventArgs e
)
339 if (e
.Name
!= "System.Web_test")
342 return Assembly
.GetExecutingAssembly ();