CheckBoxListTest.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  1. //
  2. // Tests for System.Web.UI.WebControls.CheckBoxList.cs
  3. //
  4. // Author:
  5. // Jackson Harper ([email protected])
  6. //
  7. //
  8. // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. using NUnit.Framework;
  30. using System;
  31. using System.IO;
  32. using System.Globalization;
  33. using System.Web;
  34. using System.Web.UI;
  35. using System.Web.UI.WebControls;
  36. using System.Drawing;
  37. using System.Collections;
  38. using MonoTests.SystemWeb.Framework;
  39. using MonoTests.stand_alone.WebHarness;
  40. using System.Collections.Specialized;
  41. namespace MonoTests.System.Web.UI.WebControls {
  42. public class CheckBoxListPoker : CheckBoxList {
  43. public Style CreateStyle ()
  44. {
  45. return CreateControlStyle ();
  46. }
  47. public Control FindControlPoke (string name, int offset)
  48. {
  49. return FindControl (name, offset);
  50. }
  51. public string Render ()
  52. {
  53. HtmlTextWriter writer = new HtmlTextWriter (new StringWriter ());
  54. base.Render (writer);
  55. return writer.InnerWriter.ToString ();
  56. }
  57. #if NET_2_0
  58. public new bool HasFooter
  59. {
  60. get
  61. {
  62. return base.HasFooter;
  63. }
  64. }
  65. public new bool HasHeader
  66. {
  67. get
  68. {
  69. return base.HasHeader;
  70. }
  71. }
  72. public new bool HasSeparators
  73. {
  74. get
  75. {
  76. return base.HasSeparators;
  77. }
  78. }
  79. public new int RepeatedItemCount
  80. {
  81. get
  82. {
  83. return base.RepeatedItemCount;
  84. }
  85. }
  86. public new void RaisePostDataChangedEvent ()
  87. {
  88. base.RaisePostDataChangedEvent ();
  89. }
  90. protected override Style GetItemStyle (ListItemType itemType, int repeatIndex)
  91. {
  92. Style s = new Style();
  93. s.BackColor = Color.Red;
  94. s.BorderStyle = BorderStyle.Solid;
  95. WebTest.CurrentTest.UserData = "GetItemStyle";
  96. return s;
  97. }
  98. public Style DoGetItemStyle (ListItemType itemType, int repeatIndex)
  99. {
  100. return base.GetItemStyle (itemType, repeatIndex);
  101. }
  102. public new string RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo)
  103. {
  104. HtmlTextWriter writer = new HtmlTextWriter (new StringWriter ());
  105. base.RenderItem(itemType,repeatIndex,repeatInfo,writer);
  106. return writer.InnerWriter.ToString ();
  107. }
  108. #endif
  109. }
  110. [TestFixture]
  111. public class CheckBoxListTest
  112. {
  113. [TestFixtureSetUp]
  114. public void SetUp ()
  115. {
  116. Type t = GetType ();
  117. WebTest.CopyResource (t, "CheckBoxList_Bug377703_1.aspx", "CheckBoxList_Bug377703_1.aspx");
  118. WebTest.CopyResource (t, "CheckBoxList_Bug377703_2.aspx", "CheckBoxList_Bug377703_2.aspx");
  119. WebTest.CopyResource (t, "CheckBoxList_Bug578770.aspx", "CheckBoxList_Bug578770.aspx");
  120. WebTest.CopyResource (t, "CheckBoxList_Bug600415.aspx", "CheckBoxList_Bug600415.aspx");
  121. }
  122. [Test]
  123. public void Defaults ()
  124. {
  125. CheckBoxListPoker c = new CheckBoxListPoker ();
  126. Assert.AreEqual (c.CellPadding, -1, "A1");
  127. Assert.AreEqual (c.CellSpacing, -1, "A2");
  128. Assert.AreEqual (c.RepeatColumns, 0, "A3");
  129. Assert.AreEqual (c.RepeatDirection,
  130. RepeatDirection.Vertical, "A4");
  131. Assert.AreEqual (c.RepeatLayout,
  132. RepeatLayout.Table, "A5");
  133. Assert.AreEqual (c.TextAlign, TextAlign.Right, "A6");
  134. #if NET_2_0
  135. Assert.AreEqual (false, c.HasFooter, "HasFooter");
  136. Assert.AreEqual (false, c.HasHeader, "HasHeader");
  137. Assert.AreEqual (false, c.HasSeparators, "HasSeparators");
  138. Assert.AreEqual (0, c.RepeatedItemCount, "RepeatedItemCount");
  139. Assert.AreEqual (null, c.DoGetItemStyle (ListItemType.Item, 0), "GetItemStyle");
  140. #endif
  141. }
  142. #if NET_2_0
  143. [Test]
  144. public void CheckBoxList_Bug377703_1 ()
  145. {
  146. WebTest t = new WebTest ("CheckBoxList_Bug377703_1.aspx");
  147. t.Invoker = PageInvoker.CreateOnInit (CheckBoxList_Bug377703_1_OnInit);
  148. #if NET_4_0
  149. string origHtmlFirst = "<table id=\"cbxl1\">\r\n\t<tr>\r\n\t\t<td><input id=\"cbxl1_0\" type=\"checkbox\" name=\"cbxl1$0\" value=\"x\" /><label for=\"cbxl1_0\">x</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_1\" type=\"checkbox\" name=\"cbxl1$1\" value=\"y\" /><label for=\"cbxl1_1\">y</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_2\" type=\"checkbox\" name=\"cbxl1$2\" value=\"z\" /><label for=\"cbxl1_2\">z</label></td>\r\n\t</tr>\r\n</table>";
  150. string origHtmlSecond = "<table id=\"cbxl1\">\r\n\t<tr>\r\n\t\t<td><input id=\"cbxl1_0\" type=\"checkbox\" name=\"cbxl1$0\" checked=\"checked\" value=\"x\" /><label for=\"cbxl1_0\">x</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_1\" type=\"checkbox\" name=\"cbxl1$1\" value=\"y\" /><label for=\"cbxl1_1\">y</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_2\" type=\"checkbox\" name=\"cbxl1$2\" value=\"z\" /><label for=\"cbxl1_2\">z</label></td>\r\n\t</tr>\r\n</table>";
  151. #else
  152. string origHtmlFirst = "<table id=\"cbxl1\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"cbxl1_0\" type=\"checkbox\" name=\"cbxl1$0\" /><label for=\"cbxl1_0\">x</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_1\" type=\"checkbox\" name=\"cbxl1$1\" /><label for=\"cbxl1_1\">y</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_2\" type=\"checkbox\" name=\"cbxl1$2\" /><label for=\"cbxl1_2\">z</label></td>\r\n\t</tr>\r\n</table>";
  153. string origHtmlSecond = "<table id=\"cbxl1\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"cbxl1_0\" type=\"checkbox\" name=\"cbxl1$0\" checked=\"checked\" /><label for=\"cbxl1_0\">x</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_1\" type=\"checkbox\" name=\"cbxl1$1\" /><label for=\"cbxl1_1\">y</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_2\" type=\"checkbox\" name=\"cbxl1$2\" /><label for=\"cbxl1_2\">z</label></td>\r\n\t</tr>\r\n</table>";
  154. #endif
  155. string html = t.Run ();
  156. string listHtml = HtmlDiff.GetControlFromPageHtml (html);
  157. HtmlDiff.AssertAreEqual (origHtmlFirst, listHtml, "#A1");
  158. FormRequest fr = new FormRequest (t.Response, "form1");
  159. fr.Controls.Add ("cbxl1$0");
  160. fr.Controls ["cbxl1$0"].Value = "on";
  161. fr.Controls.Add ("ctl01");
  162. fr.Controls ["ctl01"].Value = "Click me twice to have the first Item become empty";
  163. t.Request = fr;
  164. html = t.Run ();
  165. fr = new FormRequest (t.Response, "form1");
  166. fr.Controls.Add ("cbxl1$0");
  167. fr.Controls ["cbxl1$0"].Value = "on";
  168. fr.Controls.Add ("ctl01");
  169. fr.Controls ["ctl01"].Value = "Click me twice to have the first Item become empty";
  170. t.Request = fr;
  171. html = t.Run ();
  172. listHtml = HtmlDiff.GetControlFromPageHtml (html);
  173. HtmlDiff.AssertAreEqual (origHtmlSecond, listHtml, "#A2");
  174. }
  175. public static void CheckBoxList_Bug377703_1_OnInit (Page p)
  176. {
  177. CheckBoxList cbxl1 = p.FindControl ("cbxl1") as CheckBoxList;
  178. cbxl1.DataSource = new[] {
  179. new { ID = "x", Text = "X" },
  180. new { ID = "y", Text = "Y" },
  181. new { ID = "z", Text = "Z" },
  182. };
  183. cbxl1.DataValueField = "ID";
  184. cbxl1.DataTextField = "ID";
  185. cbxl1.DataBind();
  186. }
  187. [Test]
  188. public void CheckBoxList_Bug377703_2 ()
  189. {
  190. WebTest t = new WebTest ("CheckBoxList_Bug377703_2.aspx");
  191. t.Invoker = PageInvoker.CreateOnInit (CheckBoxList_Bug377703_2_OnInit);
  192. #if NET_4_0
  193. string origHtmlFirst = "<table id=\"cbxl2\">\r\n\t<tr>\r\n\t\t<td><input id=\"cbxl2_0\" type=\"checkbox\" name=\"cbxl2$0\" value=\"x\" /><label for=\"cbxl2_0\">x</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl2_1\" type=\"checkbox\" name=\"cbxl2$1\" value=\"y\" /><label for=\"cbxl2_1\">y</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl2_2\" type=\"checkbox\" name=\"cbxl2$2\" value=\"z\" /><label for=\"cbxl2_2\">z</label></td>\r\n\t</tr>\r\n</table>";
  194. string origHtmlSecond = "<table id=\"cbxl2\" class=\"aspNetDisabled\">\r\n\t<tr>\r\n\t\t<td><span class=\"aspNetDisabled\"><input id=\"cbxl2_0\" type=\"checkbox\" name=\"cbxl2$0\" checked=\"checked\" disabled=\"disabled\" value=\"x\" /><label for=\"cbxl2_0\">x</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span class=\"aspNetDisabled\"><input id=\"cbxl2_1\" type=\"checkbox\" name=\"cbxl2$1\" disabled=\"disabled\" value=\"y\" /><label for=\"cbxl2_1\">y</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span class=\"aspNetDisabled\"><input id=\"cbxl2_2\" type=\"checkbox\" name=\"cbxl2$2\" checked=\"checked\" disabled=\"disabled\" value=\"z\" /><label for=\"cbxl2_2\">z</label></span></td>\r\n\t</tr>\r\n</table>";
  195. string origHtmlThird = "<table id=\"cbxl2\" class=\"aspNetDisabled\">\r\n\t<tr>\r\n\t\t<td><span class=\"aspNetDisabled\"><input id=\"cbxl2_0\" type=\"checkbox\" name=\"cbxl2$0\" checked=\"checked\" disabled=\"disabled\" value=\"x\" /><label for=\"cbxl2_0\">x</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span class=\"aspNetDisabled\"><input id=\"cbxl2_1\" type=\"checkbox\" name=\"cbxl2$1\" disabled=\"disabled\" value=\"y\" /><label for=\"cbxl2_1\">y</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span class=\"aspNetDisabled\"><input id=\"cbxl2_2\" type=\"checkbox\" name=\"cbxl2$2\" checked=\"checked\" disabled=\"disabled\" value=\"z\" /><label for=\"cbxl2_2\">z</label></span></td>\r\n\t</tr>\r\n</table>";
  196. #else
  197. string origHtmlFirst = "<table id=\"cbxl2\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"cbxl2_0\" type=\"checkbox\" name=\"cbxl2$0\" /><label for=\"cbxl2_0\">x</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl2_1\" type=\"checkbox\" name=\"cbxl2$1\" /><label for=\"cbxl2_1\">y</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl2_2\" type=\"checkbox\" name=\"cbxl2$2\" /><label for=\"cbxl2_2\">z</label></td>\r\n\t</tr>\r\n</table>";
  198. string origHtmlSecond = "<table id=\"cbxl2\" disabled=\"disabled\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><span disabled=\"disabled\"><input id=\"cbxl2_0\" type=\"checkbox\" name=\"cbxl2$0\" checked=\"checked\" disabled=\"disabled\" /><label for=\"cbxl2_0\">x</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span disabled=\"disabled\"><input id=\"cbxl2_1\" type=\"checkbox\" name=\"cbxl2$1\" disabled=\"disabled\" /><label for=\"cbxl2_1\">y</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span disabled=\"disabled\"><input id=\"cbxl2_2\" type=\"checkbox\" name=\"cbxl2$2\" checked=\"checked\" disabled=\"disabled\" /><label for=\"cbxl2_2\">z</label></span></td>\r\n\t</tr>\r\n</table>";
  199. string origHtmlThird = "<table id=\"cbxl2\" disabled=\"disabled\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><span disabled=\"disabled\"><input id=\"cbxl2_0\" type=\"checkbox\" name=\"cbxl2$0\" checked=\"checked\" disabled=\"disabled\" /><label for=\"cbxl2_0\">x</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span disabled=\"disabled\"><input id=\"cbxl2_1\" type=\"checkbox\" name=\"cbxl2$1\" disabled=\"disabled\" /><label for=\"cbxl2_1\">y</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span disabled=\"disabled\"><input id=\"cbxl2_2\" type=\"checkbox\" name=\"cbxl2$2\" checked=\"checked\" disabled=\"disabled\" /><label for=\"cbxl2_2\">z</label></span></td>\r\n\t</tr>\r\n</table>";
  200. #endif
  201. string html = t.Run ();
  202. string listHtml = HtmlDiff.GetControlFromPageHtml (html);
  203. HtmlDiff.AssertAreEqual (origHtmlFirst, listHtml, "#A1");
  204. FormRequest fr = new FormRequest (t.Response, "form1");
  205. fr.Controls.Add ("cbxl2$0");
  206. fr.Controls ["cbxl2$0"].Value = "on";
  207. fr.Controls.Add ("cbxl2$2");
  208. fr.Controls ["cbxl2$2"].Value = "on";
  209. fr.Controls.Add ("ctl01");
  210. fr.Controls ["ctl01"].Value = "Click to toggle enable status above";
  211. t.Request = fr;
  212. html = t.Run ();
  213. listHtml = HtmlDiff.GetControlFromPageHtml (html);
  214. HtmlDiff.AssertAreEqual (origHtmlSecond, listHtml, "#A2");
  215. fr = new FormRequest (t.Response, "form1");
  216. fr.Controls.Add ("ctl02");
  217. fr.Controls ["ctl02"].Value = "Click to refresh page";
  218. t.Request = fr;
  219. html = t.Run ();
  220. listHtml = HtmlDiff.GetControlFromPageHtml (html);
  221. HtmlDiff.AssertAreEqual (origHtmlThird, listHtml, "#A3");
  222. }
  223. public static void CheckBoxList_Bug377703_2_OnInit (Page p)
  224. {
  225. CheckBoxList cbxl2 = p.FindControl ("cbxl2") as CheckBoxList;
  226. cbxl2.DataSource = new[] {
  227. new { ID = "x", Text = "X" },
  228. new { ID = "y", Text = "Y" },
  229. new { ID = "z", Text = "Z" },
  230. };
  231. cbxl2.DataValueField = "ID";
  232. cbxl2.DataTextField = "ID";
  233. cbxl2.DataBind();
  234. }
  235. [Test]
  236. public void CheckBoxList_Bug578770 ()
  237. {
  238. WebTest t = new WebTest ("CheckBoxList_Bug578770.aspx");
  239. t.Invoker = PageInvoker.CreateOnInit (CheckBoxList_Bug578770_OnInit);
  240. #if NET_4_0
  241. string origHtml = "<table id=\"test\">\r\n\t<tr>\r\n\t\t<td><span class=\"aspNetDisabled\"><input id=\"test_0\" type=\"checkbox\" name=\"test$0\" disabled=\"disabled\" value=\"Sun\" /><label for=\"test_0\">Sun</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span><input id=\"test_1\" type=\"checkbox\" name=\"test$1\" value=\"Mon\" /><label for=\"test_1\">Mon</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span><input id=\"test_2\" type=\"checkbox\" name=\"test$2\" value=\"Tue\" /><label for=\"test_2\">Tue</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span><input id=\"test_3\" type=\"checkbox\" name=\"test$3\" value=\"Wed\" /><label for=\"test_3\">Wed</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span><input id=\"test_4\" type=\"checkbox\" name=\"test$4\" value=\"Thu\" /><label for=\"test_4\">Thu</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span><input id=\"test_5\" type=\"checkbox\" name=\"test$5\" value=\"Fri\" /><label for=\"test_5\">Fri</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span><input id=\"test_6\" type=\"checkbox\" name=\"test$6\" value=\"Sat\" /><label for=\"test_6\">Sat</label></span></td>\r\n\t</tr>\r\n</table>";
  242. #else
  243. string origHtml = "<table id=\"test\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><span disabled=\"disabled\"><input id=\"test_0\" type=\"checkbox\" name=\"test$0\" disabled=\"disabled\" /><label for=\"test_0\">Sun</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"test_1\" type=\"checkbox\" name=\"test$1\" /><label for=\"test_1\">Mon</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"test_2\" type=\"checkbox\" name=\"test$2\" /><label for=\"test_2\">Tue</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"test_3\" type=\"checkbox\" name=\"test$3\" /><label for=\"test_3\">Wed</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"test_4\" type=\"checkbox\" name=\"test$4\" /><label for=\"test_4\">Thu</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"test_5\" type=\"checkbox\" name=\"test$5\" /><label for=\"test_5\">Fri</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"test_6\" type=\"checkbox\" name=\"test$6\" /><label for=\"test_6\">Sat</label></td>\r\n\t</tr>\r\n</table>";
  244. #endif
  245. string html = t.Run ();
  246. string listHtml = HtmlDiff.GetControlFromPageHtml (html);
  247. HtmlDiff.AssertAreEqual (origHtml, listHtml, "#A1");
  248. }
  249. public static void CheckBoxList_Bug578770_OnInit (Page p)
  250. {
  251. CheckBoxList test = p.FindControl ("test") as CheckBoxList;
  252. string[] weekDays = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
  253. test.DataSource = weekDays;
  254. test.DataBind();
  255. test.Items[0].Enabled = false;
  256. }
  257. [Test]
  258. public void CheckBoxList_Bug600415 ()
  259. {
  260. WebTest t = new WebTest ("CheckBoxList_Bug600415.aspx");
  261. #if NET_4_0
  262. string origHtmlFirst = "<table id=\"checkBoxList\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" checked=\"checked\" value=\"Item 1\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" value=\"Item 2\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" checked=\"checked\" value=\"Item 3\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" value=\"Item 4\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
  263. string origHtmlSecond = "<table id=\"checkBoxList\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" value=\"Item 1\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" value=\"Item 2\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" value=\"Item 3\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" value=\"Item 4\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
  264. string origHtmlThird = "<table id=\"checkBoxList\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" checked=\"checked\" value=\"Item 1\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" checked=\"checked\" value=\"Item 2\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" checked=\"checked\" value=\"Item 3\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" checked=\"checked\" value=\"Item 4\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
  265. #else
  266. string origHtmlFirst = "<table id=\"checkBoxList\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" checked=\"checked\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" checked=\"checked\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
  267. string origHtmlSecond = "<table id=\"checkBoxList\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
  268. string origHtmlThird = "<table id=\"checkBoxList\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" checked=\"checked\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" checked=\"checked\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" checked=\"checked\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" checked=\"checked\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
  269. #endif
  270. string html = t.Run ();
  271. string listHtml = HtmlDiff.GetControlFromPageHtml (html);
  272. HtmlDiff.AssertAreEqual (origHtmlFirst, listHtml, "#A1");
  273. FormRequest fr = new FormRequest (t.Response, "form1");
  274. fr.Controls.Add ("cmdClick");
  275. fr.Controls ["cmdClick"].Value = "Ok";
  276. t.Request = fr;
  277. html = t.Run ();
  278. listHtml = HtmlDiff.GetControlFromPageHtml (html);
  279. HtmlDiff.AssertAreEqual (origHtmlSecond, listHtml, "#A2");
  280. fr = new FormRequest (t.Response, "form1");
  281. fr.Controls.Add ("checkBoxList$0");
  282. fr.Controls ["checkBoxList$0"].Value = "on";
  283. fr.Controls.Add ("checkBoxList$1");
  284. fr.Controls ["checkBoxList$1"].Value = "on";
  285. fr.Controls.Add ("checkBoxList$2");
  286. fr.Controls ["checkBoxList$2"].Value = "on";
  287. fr.Controls.Add ("checkBoxList$3");
  288. fr.Controls ["checkBoxList$3"].Value = "on";
  289. t.Request = fr;
  290. html = t.Run ();
  291. listHtml = HtmlDiff.GetControlFromPageHtml (html);
  292. HtmlDiff.AssertAreEqual (origHtmlThird, listHtml, "#A3");
  293. }
  294. [Test]
  295. public void RaisePostDataChangedEvent ()
  296. {
  297. CheckBoxListPoker c = new CheckBoxListPoker ();
  298. c.SelectedIndexChanged += new EventHandler (c_SelectedIndexChanged);
  299. Assert.AreEqual (false, eventSelectedIndexChanged, "RaisePostDataChangedEvent#1");
  300. c.RaisePostDataChangedEvent ();
  301. Assert.AreEqual (true, eventSelectedIndexChanged, "RaisePostDataChangedEvent#2");
  302. }
  303. bool eventSelectedIndexChanged;
  304. void c_SelectedIndexChanged (object sender, EventArgs e)
  305. {
  306. eventSelectedIndexChanged = true;
  307. }
  308. [Test]
  309. [Category("NunitWeb")]
  310. public void GetItemStyle ()
  311. {
  312. WebTest t = new WebTest (PageInvoker.CreateOnLoad (GetItemStyle_Load));
  313. string html = t.Run ();
  314. string ctrl = HtmlDiff.GetControlFromPageHtml (html);
  315. if (ctrl == string.Empty)
  316. Assert.Fail ("CheckBoxList not created fail");
  317. Assert.AreEqual ("GetItemStyle", (string) t.UserData, "GetItemStyle not done");
  318. if ( ctrl.IndexOf("<td style=\"background-color:Red;border-style:Solid;\">") == -1)
  319. Assert.Fail ("CheckBoxList style not rendered");
  320. }
  321. public static void GetItemStyle_Load (Page p)
  322. {
  323. CheckBoxListPoker c = new CheckBoxListPoker ();
  324. ListItem l1 = new ListItem ("item1", "value1");
  325. ListItem l2 = new ListItem ("item2", "value2");
  326. c.Items.Add (l1);
  327. c.Items.Add (l2);
  328. p.Form.Controls.Add(new LiteralControl(HtmlDiff.BEGIN_TAG));
  329. p.Form.Controls.Add (c);
  330. p.Form.Controls.Add(new LiteralControl(HtmlDiff.END_TAG));
  331. }
  332. [Test]
  333. public void RenderItem ()
  334. {
  335. #if NET_4_0
  336. string origHtml1 = "<input id=\"0\" type=\"checkbox\" name=\"0\" value=\"value1\" /><label for=\"0\">item1</label>";
  337. string origHtml2 = "<input id=\"1\" type=\"checkbox\" name=\"1\" value=\"value2\" /><label for=\"1\">item2</label>";
  338. #else
  339. string origHtml1 = "<input id=\"0\" type=\"checkbox\" name=\"0\" /><label for=\"0\">item1</label>";
  340. string origHtml2 = "<input id=\"1\" type=\"checkbox\" name=\"1\" /><label for=\"1\">item2</label>";
  341. #endif
  342. CheckBoxListPoker c = new CheckBoxListPoker ();
  343. ListItem l1 = new ListItem ("item1", "value1");
  344. ListItem l2 = new ListItem ("item2", "value2");
  345. c.Items.Add (l1);
  346. c.Items.Add (l2);
  347. string html = c.RenderItem (ListItemType.Item, 0, null);
  348. HtmlDiff.AssertAreEqual (origHtml1, html, "RenderItem#1");
  349. html = c.RenderItem (ListItemType.Item, 1, null);
  350. HtmlDiff.AssertAreEqual (origHtml2, html, "RenderItem#2");
  351. }
  352. [Test]
  353. public void RepeatedItemCount ()
  354. {
  355. CheckBoxListPoker c = new CheckBoxListPoker ();
  356. ListItem l1 = new ListItem ("item1", "value1");
  357. ListItem l2 = new ListItem ("item2", "value2");
  358. Assert.AreEqual (0, c.RepeatedItemCount, "RepeatedItemCount#1");
  359. c.Items.Add (l1);
  360. c.Items.Add (l2);
  361. Assert.AreEqual (2, c.RepeatedItemCount, "RepeatedItemCount#2");
  362. }
  363. #endif
  364. [Test]
  365. public void CleanProperties ()
  366. {
  367. CheckBoxList c = new CheckBoxList ();
  368. c.CellPadding = Int32.MaxValue;
  369. Assert.AreEqual (c.CellPadding, Int32.MaxValue, "A1");
  370. c.CellSpacing = Int32.MaxValue;
  371. Assert.AreEqual (c.CellSpacing, Int32.MaxValue, "A2");
  372. c.RepeatColumns = Int32.MaxValue;
  373. Assert.AreEqual (c.RepeatColumns, Int32.MaxValue, "A3");
  374. foreach (RepeatDirection d in
  375. Enum.GetValues (typeof (RepeatDirection))) {
  376. c.RepeatDirection = d;
  377. Assert.AreEqual (c.RepeatDirection, d, "A4-" + d);
  378. }
  379. foreach (RepeatLayout l in
  380. Enum.GetValues (typeof (RepeatLayout))) {
  381. c.RepeatLayout = l;
  382. Assert.AreEqual (c.RepeatLayout, l, "A5-" + l);
  383. }
  384. }
  385. [Test]
  386. [ExpectedException (typeof (ArgumentOutOfRangeException))]
  387. public void CellPaddingTooLow ()
  388. {
  389. CheckBoxList c = new CheckBoxList ();
  390. c.CellPadding = -2;
  391. }
  392. [Test]
  393. [ExpectedException (typeof (ArgumentOutOfRangeException))]
  394. public void CellSpacingTooLow ()
  395. {
  396. CheckBoxList c = new CheckBoxList ();
  397. c.CellSpacing = -2;
  398. }
  399. [Test]
  400. [ExpectedException (typeof (ArgumentOutOfRangeException))]
  401. public void RepeatColumsTooLow ()
  402. {
  403. CheckBoxList c = new CheckBoxList ();
  404. c.RepeatColumns = -1;
  405. }
  406. [Test]
  407. [ExpectedException (typeof (ArgumentOutOfRangeException))]
  408. public void RepeatDirection_Invalid ()
  409. {
  410. CheckBoxList c = new CheckBoxList ();
  411. c.RepeatDirection = (RepeatDirection) Int32.MaxValue;
  412. }
  413. [Test]
  414. [ExpectedException (typeof (ArgumentOutOfRangeException))]
  415. public void RepeatLayout_Invalid ()
  416. {
  417. CheckBoxList c = new CheckBoxList ();
  418. c.RepeatLayout = (RepeatLayout) Int32.MaxValue;
  419. }
  420. [Test]
  421. [ExpectedException (typeof (ArgumentOutOfRangeException))]
  422. public void TextAlign_Invalid ()
  423. {
  424. CheckBoxList c = new CheckBoxList ();
  425. c.TextAlign = (TextAlign) Int32.MaxValue;
  426. }
  427. [Test]
  428. public void ChildCheckBoxControl ()
  429. {
  430. CheckBoxList c = new CheckBoxList ();
  431. Assert.AreEqual (c.Controls.Count, 1, "A1");
  432. Assert.AreEqual (c.Controls [0].GetType (), typeof (CheckBox), "A2");
  433. }
  434. [Test]
  435. public void CreateStyle ()
  436. {
  437. CheckBoxListPoker c = new CheckBoxListPoker ();
  438. Assert.AreEqual (c.CreateStyle ().GetType (), typeof (TableStyle), "A1");
  439. }
  440. [Test]
  441. public void RepeatInfoProperties ()
  442. {
  443. IRepeatInfoUser ri = new CheckBoxList ();
  444. Assert.IsFalse (ri.HasFooter, "A1");
  445. Assert.IsFalse (ri.HasHeader, "A2");
  446. Assert.IsFalse (ri.HasSeparators, "A3");
  447. Assert.AreEqual (ri.RepeatedItemCount, 0, "A4");
  448. }
  449. [Test]
  450. public void RepeatInfoCount ()
  451. {
  452. CheckBoxList c = new CheckBoxList ();
  453. IRepeatInfoUser ri = (IRepeatInfoUser) c;
  454. Assert.AreEqual (ri.RepeatedItemCount, 0, "A1");
  455. c.Items.Add ("one");
  456. c.Items.Add ("two");
  457. c.Items.Add ("three");
  458. Assert.AreEqual (ri.RepeatedItemCount, 3, "A2");
  459. }
  460. [Test]
  461. public void RepeatInfoStyle ()
  462. {
  463. IRepeatInfoUser ri = new CheckBoxList ();
  464. foreach (ListItemType t in Enum.GetValues (typeof (ListItemType))) {
  465. Assert.AreEqual (ri.GetItemStyle (t, 0), null, "A1-" + t);
  466. Assert.AreEqual (ri.GetItemStyle (t, 1), null, "A2-" + t);
  467. Assert.AreEqual (ri.GetItemStyle (t, 2), null, "A3-" + t);
  468. Assert.AreEqual (ri.GetItemStyle (t, 3), null, "A4-" + t);
  469. }
  470. }
  471. [Test]
  472. [ExpectedException (typeof (ArgumentOutOfRangeException))]
  473. public void RepeatInfoRenderOutOfRange ()
  474. {
  475. StringWriter sw = new StringWriter ();
  476. HtmlTextWriter tw = new HtmlTextWriter (sw);
  477. IRepeatInfoUser ri = new CheckBoxList ();
  478. ri.RenderItem (ListItemType.Item, -1, new RepeatInfo (), tw);
  479. }
  480. [Test]
  481. public void RepeatInfoRenderItem ()
  482. {
  483. #if NET_4_0
  484. string origHtml = "<input id=\"0\" type=\"checkbox\" name=\"0\" value=\"one\" /><label for=\"0\">one</label>";
  485. #else
  486. string origHtml = "<input id=\"0\" type=\"checkbox\" name=\"0\" /><label for=\"0\">one</label>";
  487. #endif
  488. StringWriter sw = new StringWriter ();
  489. HtmlTextWriter tw = new HtmlTextWriter (sw);
  490. CheckBoxList c = new CheckBoxList ();
  491. IRepeatInfoUser ri = (IRepeatInfoUser) c;
  492. RepeatInfo r = new RepeatInfo ();
  493. c.Items.Add ("one");
  494. c.Items.Add ("two");
  495. ri.RenderItem (ListItemType.Item, 0, r, tw);
  496. string html = sw.ToString ();
  497. Assert.AreEqual (origHtml, html, "A1");
  498. }
  499. [Test]
  500. public void FindControl ()
  501. {
  502. CheckBoxListPoker p = new CheckBoxListPoker ();
  503. p.ID = "id";
  504. p.Items.Add ("one");
  505. p.Items.Add ("two");
  506. p.Items.Add ("three");
  507. // Everything seems to return this.
  508. Assert.AreEqual (p.FindControlPoke (String.Empty, 0), p, "A1");
  509. Assert.AreEqual (p.FindControlPoke ("id", 0), p, "A2");
  510. Assert.AreEqual (p.FindControlPoke ("id_0", 0), p, "A3");
  511. Assert.AreEqual (p.FindControlPoke ("id_1", 0), p, "A4");
  512. Assert.AreEqual (p.FindControlPoke ("id_2", 0), p, "A5");
  513. Assert.AreEqual (p.FindControlPoke ("id_3", 0), p, "A6");
  514. Assert.AreEqual (p.FindControlPoke ("0", 0), p, "A7");
  515. Assert.AreEqual (p.FindControlPoke (String.Empty, 10), p, "A1");
  516. Assert.AreEqual (p.FindControlPoke ("id", 10), p, "A2");
  517. Assert.AreEqual (p.FindControlPoke ("id_0", 10), p, "A3");
  518. Assert.AreEqual (p.FindControlPoke ("id_1", 10), p, "A4");
  519. Assert.AreEqual (p.FindControlPoke ("id_2", 10), p, "A5");
  520. Assert.AreEqual (p.FindControlPoke ("id_3", 10), p, "A6");
  521. Assert.AreEqual (p.FindControlPoke ("0", 10), p, "A7");
  522. }
  523. private void Render (CheckBoxList list, string expected, string test)
  524. {
  525. StringWriter sw = new StringWriter ();
  526. HtmlTextWriter tw = new CleanHtmlTextWriter (sw);
  527. sw.NewLine = "\n";
  528. list.RenderControl (tw);
  529. HtmlDiff.AssertAreEqual (expected, sw.ToString (), test);
  530. }
  531. [Test]
  532. public void RenderEmpty ()
  533. {
  534. CheckBoxList c = new CheckBoxList ();
  535. #if NET_2_0
  536. Render (c, "", "A1");
  537. #else
  538. Render (c, "<table border=\"0\">\n\n</table>", "A1");
  539. #endif
  540. c.CellPadding = 1;
  541. #if NET_2_0
  542. Render (c, "", "A2");
  543. #else
  544. Render (c, "<table border=\"0\" cellpadding=\"1\">\n\n</table>", "A2");
  545. #endif
  546. c = new CheckBoxList ();
  547. c.CellPadding = 1;
  548. #if NET_2_0
  549. Render (c, "", "A3");
  550. #else
  551. Render (c, "<table border=\"0\" cellpadding=\"1\">\n\n</table>", "A3");
  552. #endif
  553. c = new CheckBoxList ();
  554. c.TextAlign = TextAlign.Left;
  555. #if NET_2_0
  556. Render (c, "", "A4");
  557. #else
  558. Render (c, "<table border=\"0\">\n\n</table>", "A4");
  559. #endif
  560. }
  561. [Test]
  562. #if NET_2_0
  563. [Category("NotDotNet")] // MS's implementation throws NRE's from these
  564. #endif
  565. public void Render ()
  566. {
  567. #if NET_4_0
  568. string origHtml1 = "<table>\n\t<tr>\n\t\t<td><input id=\"0\" name=\"0\" type=\"checkbox\" value=\"foo\"/><label for=\"0\">foo</label></td>\n\t</tr>\n</table>";
  569. string origHtml2 = "<table>\n\t<tr>\n\t\t<td><input id=\"0\" name=\"0\" type=\"checkbox\" value=\"foo\"/><label for=\"0\">foo</label></td>\n\t</tr>\n</table>";
  570. #else
  571. string origHtml1 = "<table border=\"0\">\n\t<tr>\n\t\t<td><input id=\"0\" name=\"0\" type=\"checkbox\" /><label for=\"0\">foo</label></td>\n\t</tr>\n</table>";
  572. string origHtml2 = "<table border=\"0\">\n\t<tr>\n\t\t<td><input id=\"0\" name=\"0\" type=\"checkbox\" /><label for=\"0\">foo</label></td>\n\t</tr>\n</table>";
  573. #endif
  574. CheckBoxList c;
  575. c = new CheckBoxList ();
  576. c.Items.Add ("foo");
  577. Render (c, origHtml1, "A5");
  578. c = new CheckBoxList ();
  579. c.Items.Add ("foo");
  580. Render (c, origHtml2, "A6");
  581. }
  582. // bug 51648
  583. [Test]
  584. #if NET_2_0
  585. [Category("NotDotNet")] // MS's implementation throws NRE's from these
  586. #endif
  587. public void TestTabIndex ()
  588. {
  589. CheckBoxList c = new CheckBoxList ();
  590. c.TabIndex = 5;
  591. c.Items.Add ("Item1");
  592. #if NET_4_0
  593. string exp = @"<table>
  594. <tr>
  595. <td><input id=""0"" name=""0"" tabindex=""5"" type=""checkbox"" value=""Item1""/><label for=""0"">Item1</label></td>
  596. </tr>
  597. </table>";
  598. #else
  599. string exp = @"<table border=""0"">
  600. <tr>
  601. <td><input id=""0"" name=""0"" tabindex=""5"" type=""checkbox"" /><label for=""0"">Item1</label></td>
  602. </tr>
  603. </table>";
  604. #endif
  605. Render (c, exp, "B1");
  606. }
  607. // bug 48802
  608. [Test]
  609. #if NET_2_0
  610. [Category("NotDotNet")] // MS's implementation throws NRE's from these
  611. #endif
  612. public void TestDisabled ()
  613. {
  614. CheckBoxList c = new CheckBoxList ();
  615. c.Enabled = false;
  616. c.Items.Add ("Item1");
  617. #if NET_4_0
  618. string exp = @"<table class=""aspNetDisabled"">
  619. <tr>
  620. <td><span class=""aspNetDisabled""><input disabled=""disabled"" id=""0"" name=""0"" type=""checkbox"" value=""Item1""/><label for=""0"">Item1</label></span></td>
  621. </tr>
  622. </table>";
  623. #else
  624. string exp = @"<table border=""0"" disabled=""disabled"">
  625. <tr>
  626. <td><span disabled=""disabled""><input disabled=""disabled"" id=""0"" name=""0"" type=""checkbox"" /><label for=""0"">Item1</label></span></td>
  627. </tr>
  628. </table>";
  629. #endif
  630. Render (c, exp, "C1");
  631. }
  632. #if NET_2_0
  633. class TestCheckBoxList : CheckBoxList
  634. {
  635. public new virtual void VerifyMultiSelect()
  636. {
  637. base.VerifyMultiSelect();
  638. }
  639. }
  640. [Test]
  641. public void VerifyMultiSelectTest()
  642. {
  643. TestCheckBoxList list = new TestCheckBoxList();
  644. list.VerifyMultiSelect();
  645. }
  646. [TestFixtureTearDown]
  647. public void teardown ()
  648. {
  649. WebTest.Unload ();
  650. }
  651. #endif
  652. }
  653. }