* Makefile: Don't build make-map.exe.
[mono.git] / mcs / class / System.Web / Test / System.Web.UI / PostBackOptionsTest.cs
1 //\r
2 // Tests for System.Web.UI.PostBackOptions.cs \r
3 //\r
4 // Author:\r
5 //      Igor Zelmanovich (igorz@mainsoft.com)\r
6 //\r
7 \r
8 //\r
9 // Copyright (C) 2006 Mainsoft, Inc (http://www.mainsoft.com)\r
10 //\r
11 // Permission is hereby granted, free of charge, to any person obtaining\r
12 // a copy of this software and associated documentation files (the\r
13 // "Software"), to deal in the Software without restriction, including\r
14 // without limitation the rights to use, copy, modify, merge, publish,\r
15 // distribute, sublicense, and/or sell copies of the Software, and to\r
16 // permit persons to whom the Software is furnished to do so, subject to\r
17 // the following conditions:\r
18 // \r
19 // The above copyright notice and this permission notice shall be\r
20 // included in all copies or substantial portions of the Software.\r
21 // \r
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
29 //\r
30 \r
31 #if NET_2_0\r
32 using NUnit.Framework;\r
33 using System;\r
34 using System.IO;\r
35 using System.Globalization;\r
36 using System.Web;\r
37 using System.Web.UI;\r
38 using System.Web.UI.WebControls;\r
39 using System.Collections;\r
40 \r
41 namespace MonoTests.System.Web.UI\r
42 {\r
43         [TestFixture]\r
44         public class PostBackOptionsTest\r
45         {\r
46                 [Test]\r
47                 public void Constructors () {\r
48                         Control c = new WebControl(HtmlTextWriterTag.A);\r
49                         c.Page = new Page ();\r
50                         PostBackOptions options=new PostBackOptions(c);\r
51                         Assert.IsFalse (options.PerformValidation);\r
52                         Assert.IsFalse (options.AutoPostBack);\r
53                         Assert.IsFalse (options.TrackFocus);\r
54                         Assert.IsTrue (options.ClientSubmit);\r
55                         // MSDN: The default value is true, BUT FALSE\r
56                         Assert.IsFalse (options.RequiresJavaScriptProtocol);\r
57                         // MSDN: The default value is an empty string (""), BUT NULL\r
58                         Assert.AreEqual (null, options.Argument);\r
59                         // MSDN: The default value is an empty string (""), BUT NULL\r
60                         Assert.AreEqual (null, options.ActionUrl);\r
61                         // MSDN: The default value is an empty string (""), BUT NULL\r
62                         Assert.AreEqual (null, options.ValidationGroup);\r
63 \r
64                         options = new PostBackOptions (c, null);\r
65                         Assert.IsFalse (options.PerformValidation);\r
66                         Assert.IsFalse (options.AutoPostBack);\r
67                         Assert.IsFalse (options.TrackFocus);\r
68                         Assert.IsTrue (options.ClientSubmit);\r
69                         Assert.IsFalse (options.RequiresJavaScriptProtocol);\r
70                         Assert.AreEqual (null, options.Argument);\r
71                         Assert.AreEqual (null, options.ActionUrl);\r
72                         Assert.AreEqual (null, options.ValidationGroup);\r
73 \r
74                         options = new PostBackOptions (c, null, null, false, false, false, false, false, null);\r
75                         Assert.IsFalse (options.PerformValidation);\r
76                         Assert.IsFalse (options.AutoPostBack);\r
77                         Assert.IsFalse (options.TrackFocus);\r
78                         Assert.IsFalse (options.ClientSubmit);\r
79                         Assert.IsFalse (options.RequiresJavaScriptProtocol);\r
80                         Assert.AreEqual (null, options.Argument);\r
81                         Assert.AreEqual (null, options.ActionUrl);\r
82                         Assert.AreEqual (null, options.ValidationGroup);\r
83 \r
84                         options = new PostBackOptions (c, "ARG");\r
85                         Assert.IsFalse (options.PerformValidation);\r
86                         Assert.IsFalse (options.AutoPostBack);\r
87                         Assert.IsFalse (options.TrackFocus);\r
88                         Assert.IsTrue (options.ClientSubmit);\r
89                         Assert.IsFalse (options.RequiresJavaScriptProtocol);\r
90                         Assert.AreEqual ("ARG", options.Argument);\r
91                         Assert.AreEqual (null, options.ActionUrl);\r
92                         Assert.AreEqual (null, options.ValidationGroup);\r
93 \r
94                         options = new PostBackOptions (c, "ARG", "Page.aspx", true, true, false, false, false, "VG");\r
95                         Assert.IsFalse (options.PerformValidation);\r
96                         Assert.IsTrue (options.AutoPostBack);\r
97                         Assert.IsFalse (options.TrackFocus);\r
98                         Assert.IsFalse (options.ClientSubmit);\r
99                         Assert.IsTrue (options.RequiresJavaScriptProtocol);\r
100                         Assert.AreEqual ("ARG", options.Argument);\r
101                         Assert.AreEqual ("Page.aspx", options.ActionUrl);\r
102                         Assert.AreEqual ("VG", options.ValidationGroup);\r
103                 }\r
104         }\r
105 }\r
106 #endif