[bcl] Remove NET_4_0 defines from class libs
[mono.git] / mcs / class / System.Web / Test / System.Web.UI.WebControls / CheckBoxFieldTest.cs
1 //
2 // Tests for System.Web.UI.WebControls.CheckBoxFieldTest.cs
3 //
4 // Author:
5 //      Yoni Klein (yonik@mainsoft.com)
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
30
31
32 using System;
33 using System.Collections.Generic;
34 using System.Text;
35 using System.Web;
36 using System.Web.UI;
37 using System.Web.UI.WebControls;
38 using System.IO;
39 using System.Drawing;
40 using System.Collections;
41 using System.Collections.Specialized;
42 using NUnit.Framework;
43 using System.Data;
44
45 using MonoTests.SystemWeb.Framework;
46 using MonoTests.stand_alone.WebHarness;
47
48 namespace MonoTests.System.Web.UI.WebControls
49 {
50         class PokerCheckBoxField : CheckBoxField
51         {
52                 // View state Stuff
53                 public PokerCheckBoxField ()
54                         : base ()
55                 {
56                         TrackViewState ();
57                 }
58
59                 public object SaveState ()
60                 {
61                         return SaveViewState ();
62                 }
63
64                 public void LoadState (object o)
65                 {
66                         LoadViewState (o);
67                 }
68
69                 public StateBag StateBag
70                 {
71                         get { return base.ViewState; }
72                 }
73
74                 public bool GetSupportsHtmlEncode
75                 {
76                         get
77                         {
78                                 return base.SupportsHtmlEncode;
79                         }
80                 }
81
82                 public void DoCopyProperties (DataControlField newField)
83                 {
84                         base.CopyProperties (newField);
85                 }
86
87                 public DataControlField DoCreateField ()
88                 {
89                         return base.CreateField ();
90                 }
91
92                 public object DoGetDesignTimeValue ()
93                 {
94                         return base.GetDesignTimeValue ();
95                 }
96
97                 public void DoInitializeDataCell (DataControlFieldCell cell, DataControlRowState rowState)
98                 {
99                         this.InitializeDataCell (cell, rowState);
100                 }
101
102                 protected override void OnDataBindField (object sender, EventArgs e)
103                 {
104                         base.OnDataBindField (sender, e);
105                         CheckBoxFieldTest.databound += 1;
106                 }
107         }
108         
109         [TestFixture]
110         public class CheckBoxFieldTest
111         {
112                 public const string FIELDNAME  = "checkbox";
113                 public const string WRONGFIELD = "str";
114                 public static int databound;
115
116                 [TestFixtureSetUp]
117                 public void SetUp ()
118                 {
119                         WebTest.CopyResource (GetType (), "CheckBoxField_Bug595568_0.aspx", "CheckBoxField_Bug595568_0.aspx");
120                         WebTest.CopyResource (GetType (), "CheckBoxField_Bug595568_1.aspx", "CheckBoxField_Bug595568_1.aspx");
121                         WebTest.CopyResource (GetType (), "CheckBoxField_Bug595568_2.aspx", "CheckBoxField_Bug595568_2.aspx");
122                         WebTest.CopyResource (GetType (), "CheckBoxField_Bug595568_5.aspx", "CheckBoxField_Bug595568_5.aspx");
123                         WebTest.CopyResource (GetType (), "CheckBoxField_Bug595568_6.aspx", "CheckBoxField_Bug595568_6.aspx");
124                         WebTest.CopyResource (GetType (), "CheckBoxField_Bug595568_7.aspx", "CheckBoxField_Bug595568_7.aspx");
125                 }
126
127                 [Test (Description="Bug 595568 #0")]
128                 public void CheckBoxField_Bug595568_0 ()
129                 {
130                         string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"gridView\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\">&nbsp;</th>\r\n\t\t</tr><tr>\r\n\t\t\t<td><span title=\"Dummy\"><input id=\"gridView_ctl00_0\" type=\"checkbox\" name=\"gridView$ctl02$ctl00\" checked=\"checked\" /></span></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><span title=\"Dummy\"><input id=\"gridView_ctl00_1\" type=\"checkbox\" name=\"gridView$ctl03$ctl00\" /></span></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><span title=\"Dummy\"><input id=\"gridView_ctl00_2\" type=\"checkbox\" name=\"gridView$ctl04$ctl00\" /></span></td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
131                         WebTest t = new WebTest ("CheckBoxField_Bug595568_0.aspx");
132                         string pageHtml = t.Run ();
133                         string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
134
135                         HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
136                 }
137
138                 [Test (Description="Bug 595568 #1")]
139                 public void CheckBoxField_Bug595568_1 ()
140                 {
141                         string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"gridView\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\">&nbsp;</th>\r\n\t\t</tr><tr>\r\n\t\t\t<td><select size=\"4\" name=\"gridView$ctl02$ctl00\">\r\n\r\n\t\t\t</select><span title=\"Dummy\"><input id=\"gridView_ctl01_0\" type=\"checkbox\" name=\"gridView$ctl02$ctl01\" checked=\"checked\" /></span></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><select size=\"4\" name=\"gridView$ctl03$ctl00\">\r\n\r\n\t\t\t</select><span title=\"Dummy\"><input id=\"gridView_ctl01_1\" type=\"checkbox\" name=\"gridView$ctl03$ctl01\" /></span></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><select size=\"4\" name=\"gridView$ctl04$ctl00\">\r\n\r\n\t\t\t</select><span title=\"Dummy\"><input id=\"gridView_ctl01_2\" type=\"checkbox\" name=\"gridView$ctl04$ctl01\" /></span></td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
142                         WebTest t = new WebTest ("CheckBoxField_Bug595568_1.aspx");
143                         string pageHtml = t.Run ();
144                         string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
145
146                         HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
147                 }
148
149                 [Test (Description="Bug 595568 #2")]
150                 public void CheckBoxField_Bug595568_2 ()
151                 {
152                         string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"gridView\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\">&nbsp;</th>\r\n\t\t</tr><tr>\r\n\t\t\t<td><input id=\"gridView_ctl00_0\" type=\"checkbox\" name=\"gridView$ctl02$ctl00\" /><span title=\"Dummy\"><input id=\"gridView_ctl01_0\" type=\"checkbox\" name=\"gridView$ctl02$ctl01\" checked=\"checked\" /></span><input id=\"gridView_ctl02_0\" type=\"checkbox\" name=\"gridView$ctl02$ctl02\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><input id=\"gridView_ctl00_1\" type=\"checkbox\" name=\"gridView$ctl03$ctl00\" /><span title=\"Dummy\"><input id=\"gridView_ctl01_1\" type=\"checkbox\" name=\"gridView$ctl03$ctl01\" /></span><input id=\"gridView_ctl02_1\" type=\"checkbox\" name=\"gridView$ctl03$ctl02\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><input id=\"gridView_ctl00_2\" type=\"checkbox\" name=\"gridView$ctl04$ctl00\" /><span title=\"Dummy\"><input id=\"gridView_ctl01_2\" type=\"checkbox\" name=\"gridView$ctl04$ctl01\" /></span><input id=\"gridView_ctl02_2\" type=\"checkbox\" name=\"gridView$ctl04$ctl02\" /></td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
153                         
154                         WebTest t = new WebTest ("CheckBoxField_Bug595568_2.aspx");
155                         string pageHtml = t.Run ();
156                         string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
157
158                         HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
159                 }
160
161                 [Test (Description="Bug 595568 #5")]
162                 public void CheckBoxField_Bug595568_5 ()
163                 {
164                         string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"gridView\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\">&nbsp;</th>\r\n\t\t</tr><tr>\r\n\t\t\t<td><select size=\"4\" name=\"gridView$ctl02$ctl00\">\r\n\r\n\t\t\t</select></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><select size=\"4\" name=\"gridView$ctl03$ctl00\">\r\n\r\n\t\t\t</select></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><select size=\"4\" name=\"gridView$ctl04$ctl00\">\r\n\r\n\t\t\t</select></td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
165
166                         WebTest t = new WebTest ("CheckBoxField_Bug595568_5.aspx");
167                         string pageHtml = t.Run ();
168                         string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
169
170                         HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
171                 }
172                 
173                 [Test (Description="Bug 595568 #6")]
174                 public void CheckBoxField_Bug595568_6 ()
175                 {       
176                         string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"gridView\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\">&nbsp;</th>\r\n\t\t</tr><tr>\r\n\t\t\t<td><select size=\"4\" name=\"gridView$ctl02$ctl00\">\r\n\r\n\t\t\t</select><input id=\"gridView_ctl01_0\" type=\"checkbox\" name=\"gridView$ctl02$ctl01\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><select size=\"4\" name=\"gridView$ctl03$ctl00\">\r\n\r\n\t\t\t</select><input id=\"gridView_ctl01_1\" type=\"checkbox\" name=\"gridView$ctl03$ctl01\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><select size=\"4\" name=\"gridView$ctl04$ctl00\">\r\n\r\n\t\t\t</select><input id=\"gridView_ctl01_2\" type=\"checkbox\" name=\"gridView$ctl04$ctl01\" /></td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
177
178                         WebTest t = new WebTest ("CheckBoxField_Bug595568_6.aspx");
179                         string pageHtml = t.Run ();
180                         string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
181
182                         HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
183                 }
184
185                 [Test (Description="Bug 595568 #7")]
186                 public void CheckBoxField_Bug595568_7 ()
187                 {
188                         string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"gridView\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\">&nbsp;</th>\r\n\t\t</tr><tr>\r\n\t\t\t<td><input id=\"gridView_ctl00_0\" type=\"checkbox\" name=\"gridView$ctl02$ctl00\" /><select size=\"4\" name=\"gridView$ctl02$ctl01\">\r\n\r\n\t\t\t</select></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><input id=\"gridView_ctl00_1\" type=\"checkbox\" name=\"gridView$ctl03$ctl00\" /><select size=\"4\" name=\"gridView$ctl03$ctl01\">\r\n\r\n\t\t\t</select></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><input id=\"gridView_ctl00_2\" type=\"checkbox\" name=\"gridView$ctl04$ctl00\" /><select size=\"4\" name=\"gridView$ctl04$ctl01\">\r\n\r\n\t\t\t</select></td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
189                         WebTest t = new WebTest ("CheckBoxField_Bug595568_7.aspx");             
190                         string pageHtml = t.Run ();
191                         string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
192
193                         HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
194                 }
195                 
196                 [Test]
197                 public void CheckBoxField_DefaultProperty ()
198                 {
199                         PokerCheckBoxField field = new PokerCheckBoxField ();
200                         Assert.AreEqual ("", field.DataField, "DataField");
201                         Assert.AreEqual ("", field.Text, "Text");
202                         Assert.AreEqual (false, field.GetSupportsHtmlEncode, "SupportsHtmlEncode"); 
203                 }
204
205                 [Test]
206                 public void CheckBoxField_AssignProperty ()
207                 {
208                         PokerCheckBoxField field = new PokerCheckBoxField ();
209                         field.DataField = "test";
210                         Assert.AreEqual ("test", field.DataField, "DataField");
211                         field.Text = "test";
212                         Assert.AreEqual ("test", field.Text, "Text");
213                 }
214
215                 public void CheckBoxField_ExtractValuesFromCell ()
216                 {
217                         PokerCheckBoxField field = new PokerCheckBoxField ();
218                         OrderedDictionary dictionary = new OrderedDictionary ();
219                         DataControlFieldCell cell = new DataControlFieldCell (null);
220                         cell.Controls.Add (new CheckBox ());
221                         field.ExtractValuesFromCell (dictionary, cell, DataControlRowState.Normal, true);
222                         Assert.AreEqual (1, dictionary.Count, "ExtractValuesFromCellCount#1");
223                         Assert.AreEqual ("False", dictionary[0].ToString (), "ExtractValuesFromCellValueFalse");
224                         CheckBox cb = new CheckBox ();
225                         cb.Checked = true;
226                         cell.Controls.Clear ();
227                         cell.Controls.Add (cb);
228                         field.ExtractValuesFromCell (dictionary, cell, DataControlRowState.Normal, true);
229                         Assert.AreEqual (1, dictionary.Count, "ExtractValuesFromCellCount#2");
230                         Assert.AreEqual ("True", dictionary[0].ToString (), "ExtractValuesFromCellValueTrue");
231                 }
232
233                 [Test]
234                 public void CheckBoxField_ValidateSupportsCallback ()
235                 {
236                         PokerCheckBoxField field = new PokerCheckBoxField ();
237                         field.ValidateSupportsCallback ();
238                 }
239
240                 [Test]
241                 public void CheckBoxField_CopyProperties()
242                 {
243                         PokerCheckBoxField field = new PokerCheckBoxField ();
244                         CheckBoxField copy = new CheckBoxField();
245                         field.DataField = "test";
246                         field.Text = "test";
247                         field.DoCopyProperties (copy);
248                         Assert.AreEqual ("test", copy.Text, "Text");
249                         Assert.AreEqual ("test", copy.DataField, "DataField");
250                 }
251
252                 [Test]
253                 public void CheckBoxField_CreateField ()
254                 {
255                         PokerCheckBoxField field = new PokerCheckBoxField ();
256                         CheckBoxField blank = (CheckBoxField)field.DoCreateField ();
257                         Assert.IsNotNull (blank, "CreateField");
258                 }
259
260                 [Test]
261                 public void CheckBoxField_GetDesignTimeValue ()
262                 {
263                         PokerCheckBoxField field = new PokerCheckBoxField ();
264                         bool result = (bool)field.DoGetDesignTimeValue ();
265                         Assert.AreEqual (true, result, "GetDesignTimeValue");
266                 }
267
268                 [Test]
269                 public void CheckBoxField_InitializeDataCell ()
270                 {
271                         PokerCheckBoxField field = new PokerCheckBoxField ();
272                         field.HeaderText = "headertest";
273                         DataControlFieldCell cell = new DataControlFieldCell (null);
274                         DataControlRowState state = DataControlRowState.Edit;
275                         Assert.AreEqual (0, cell.Controls.Count, "InitializeDataCellControlsBeforeInit");
276                         field.DoInitializeDataCell (cell, state);
277                         Assert.AreEqual (1, cell.Controls.Count, "InitializeDataCellControlsAfterInit");
278                         Assert.AreEqual ("headertest", ((CheckBox)cell.Controls[0]).ToolTip, "InitializeDataCellControlsData");
279
280                         cell.Controls.Clear ();
281                         field.DataField = "fake";
282                         field.Text = "celltext";
283                         state = DataControlRowState.Normal;
284                         field.DoInitializeDataCell (cell, state);
285                         Assert.AreEqual (1, cell.Controls.Count, "InitializeDataCellControlsAfterInit");
286                         Assert.AreEqual ("celltext", ((CheckBox) cell.Controls[0]).Text, "InitializeDataCellControlsData");
287                 }
288
289                 [Test]
290                 public void CheckBoxField_OnDataBindField ()
291                 {
292                         Page page = new Page ();
293                         GridView grid = new GridView ();
294                         page.Controls.Add (grid);
295                         grid.DataSource = this.CreateDataSource ();
296                         grid.AutoGenerateColumns = false;
297                         PokerCheckBoxField field = new PokerCheckBoxField ();
298                         field.HeaderText = "field_header";
299                         field.FooterText = "field_footer";
300                         field.DataField = FIELDNAME;
301                         grid.Columns.Add (field);
302                         grid.DataBind ();
303                         Assert.AreEqual (2, databound, "DataBindField");
304                         Assert.AreEqual (4, ((Control) grid.Controls[0]).Controls.Count, "DataBindFieldRowCountr");
305                 }
306
307                 [Test]
308                 [ExpectedException (typeof (HttpException))]
309                 public void CheckBoxField_OnDataBindFieldException ()
310                 {
311                         Page page = new Page ();
312                         GridView grid = new GridView ();
313                         page.Controls.Add (grid);
314                         grid.DataSource = this.CreateDataSource ();
315                         grid.AutoGenerateColumns = false;
316                         PokerCheckBoxField field = new PokerCheckBoxField ();
317                         field.HeaderText = "field_header";
318                         field.FooterText = "field_footer";
319                         field.DataField = WRONGFIELD;
320                         grid.Columns.Add (field);
321                         grid.DataBind ();
322                 }
323
324                 [Test]
325                 [ExpectedException(typeof(NotSupportedException))]
326                 public void CheckBoxField_GetApplyFormatInEditModeExeption ()
327                 {
328                         PokerCheckBoxField field = new PokerCheckBoxField ();
329                         bool stab = field.ApplyFormatInEditMode;
330                 }
331
332                 [Test]
333                 [ExpectedException (typeof (NotSupportedException))]
334                 public void CheckBoxField_SetApplyFormatInEditModeExeption ()
335                 {
336                         PokerCheckBoxField field = new PokerCheckBoxField ();
337                         field.ApplyFormatInEditMode = true;
338                 }
339
340                 [Test]
341                 [ExpectedException (typeof (NotSupportedException))]
342                 public void CheckBoxField_GetConvertEmptyStringToNull ()
343                 {
344                         PokerCheckBoxField field = new PokerCheckBoxField ();
345                         bool stab = field.ConvertEmptyStringToNull;
346                 }
347
348                 [Test]
349                 [ExpectedException (typeof (NotSupportedException))]
350                 public void CheckBoxField_SetConvertEmptyStringToNull ()
351                 {
352                         PokerCheckBoxField field = new PokerCheckBoxField ();
353                         field.ConvertEmptyStringToNull = true;
354                 }
355
356                 [Test]
357                 [ExpectedException (typeof (NotSupportedException))]
358                 public void CheckBoxField_SetDataFormatString ()
359                 {
360                         PokerCheckBoxField field = new PokerCheckBoxField ();
361                         field.DataFormatString = "";
362                 }
363
364                 [Test]
365                 [ExpectedException (typeof (NotSupportedException))]
366                 public void CheckBoxField_GetDataFormatString ()
367                 {
368                         PokerCheckBoxField field = new PokerCheckBoxField ();
369                         string res = field.DataFormatString;
370                 }
371
372                 [Test]
373                 [ExpectedException (typeof (NotSupportedException))]
374                 public void CheckBoxField_SetHtmlEncode ()
375                 {
376                         PokerCheckBoxField field = new PokerCheckBoxField ();
377                         field.HtmlEncode = true;
378                 }
379
380                 [Test]
381                 [ExpectedException (typeof (NotSupportedException))]
382                 public void CheckBoxField_GetHtmlEncode ()
383                 {
384                         PokerCheckBoxField field = new PokerCheckBoxField ();
385                         bool res = field.HtmlEncode;
386                 }
387
388                 [Test]
389                 [ExpectedException (typeof (NotSupportedException))]
390                 public void CheckBoxField_SetNullDisplayText ()
391                 {
392                         PokerCheckBoxField field = new PokerCheckBoxField ();
393                         field.NullDisplayText = "";
394                 }
395
396                 [Test]
397                 [ExpectedException (typeof (NotSupportedException))]
398                 public void CheckBoxField_GetNullDisplayText ()
399                 {
400                         PokerCheckBoxField field = new PokerCheckBoxField ();
401                         string res = field.NullDisplayText;
402                 }
403
404                 public  DataTable CreateDataSource ()
405                 {
406                         DataTable aTable = new DataTable ("A");
407                         DataColumn dtCol;
408                         DataRow dtRow;
409                         // Create ID column and add to the DataTable.
410                         dtCol = new DataColumn ();
411                         dtCol.DataType = Type.GetType ("System.Boolean");
412                         dtCol.ColumnName = FIELDNAME;
413                         dtCol.Caption = FIELDNAME;
414                         dtCol.ReadOnly = true;
415
416                         // Add the column to the DataColumnCollection.
417                         aTable.Columns.Add (dtCol);
418
419
420                         dtCol = new DataColumn ();
421                         dtCol.DataType = Type.GetType ("System.String");
422                         dtCol.ColumnName = WRONGFIELD;
423                         dtCol.Caption = WRONGFIELD;
424                         dtCol.ReadOnly = true;
425                         
426
427                         // Add the column to the DataColumnCollection.
428                         aTable.Columns.Add (dtCol);
429
430                         // Create 2 rows to the table
431                         dtRow = aTable.NewRow ();
432                         dtRow[FIELDNAME] = true;
433                         dtRow[WRONGFIELD] = "1";
434                         aTable.Rows.Add (dtRow);
435
436                         dtRow = aTable.NewRow ();
437                         dtRow[FIELDNAME] = false;
438                         dtRow[WRONGFIELD] = "1";
439                         aTable.Rows.Add (dtRow);
440                         return aTable;
441                 }
442         }
443 }