2 // Tests for System.Web.UI.WebControls.ListBoxTest.cs
5 // Jackson Harper (jackson@ximian.com)
9 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using NUnit.Framework;
34 using System.Collections;
35 using System.Globalization;
38 using System.Web.UI.WebControls;
40 using MonoTests.stand_alone.WebHarness;
41 using MonoTests.SystemWeb.Framework;
44 namespace MonoTests.System.Web.UI.WebControls
47 public class ListControlPoker : ListControl {
49 public ListControlPoker ()
53 public void TrackState ()
58 public object SaveState ()
60 return SaveViewState ();
63 public void LoadState (object state)
65 LoadViewState (state);
68 public object ViewStateValue (string name)
70 return ViewState [name];
73 public string Render ()
75 StringWriter sw = new StringWriter ();
77 HtmlTextWriter writer = new HtmlTextWriter (sw);
79 return writer.InnerWriter.ToString ();
83 public HtmlTextWriterTag GetTagKey ()
88 public new void OnSelectedIndexChanged (EventArgs e)
90 base.OnSelectedIndexChanged (e);
93 public new void OnTextChanged (EventArgs e)
95 base.OnTextChanged (e);
98 public new void VerifyMultiSelect ()
100 base.VerifyMultiSelect ();
107 public class ListControlTest
109 #region help_class_for_addattributetorender
110 class Poker : ListControl
112 public void TrackState ()
117 public object SaveState ()
119 return SaveViewState ();
122 public void LoadState (object state)
124 LoadViewState (state);
127 public object ViewStateValue (string name)
129 return ViewState[name];
133 public string Render ()
135 StringWriter sw = new StringWriter ();
137 HtmlTextWriter writer = new HtmlTextWriter (sw);
138 base.Render (writer);
139 return writer.InnerWriter.ToString ();
142 ArrayList Databound ()
144 ArrayList list = new ArrayList ();
151 public HtmlTextWriterTag GetTagKey ()
156 protected override void AddAttributesToRender (HtmlTextWriter writer)
158 writer.AddAttribute (HtmlTextWriterAttribute.Type, "MyType");
159 writer.AddAttribute (HtmlTextWriterAttribute.Name, "MyName");
160 writer.AddAttribute (HtmlTextWriterAttribute.Value, "MyValue");
161 base.AddAttributesToRender (writer);
164 protected override void PerformDataBinding (IEnumerable dataSource)
166 base.PerformDataBinding (Databound());
169 protected override void PerformSelect ()
171 base.PerformSelect ();
175 public new void SetPostDataSelection(int selectedItem)
177 base.SetPostDataSelection(selectedItem);
182 private Hashtable changed = new Hashtable ();
188 WebTest.CopyResource (GetType (), "ListControlPage.aspx", "ListControlPage.aspx");
193 public void DefaultProperties ()
195 ListControlPoker p = new ListControlPoker ();
197 Assert.AreEqual (p.AutoPostBack, false, "A1");
198 Assert.AreEqual (p.DataMember, String.Empty, "A2");
199 Assert.AreEqual (p.DataSource, null, "A3");
200 Assert.AreEqual (p.DataTextField, String.Empty, "A4");
201 Assert.AreEqual (p.DataTextFormatString, String.Empty, "A5");
202 Assert.AreEqual (p.DataValueField, String.Empty, "A6");
203 Assert.AreEqual (p.Items.Count, 0, "A7");
204 Assert.AreEqual (p.SelectedIndex, -1,"A8");
205 Assert.AreEqual (p.SelectedItem, null, "A9");
206 Assert.AreEqual (p.SelectedValue, String.Empty, "A10");
208 Assert.IsFalse (p.AppendDataBoundItems, "A11");
209 Assert.AreEqual (p.Text, "", "A12");
210 Assert.AreEqual (p.GetTagKey(), HtmlTextWriterTag.Select, "A13");
211 Assert.AreEqual (false, p.AppendDataBoundItems, "A14");
212 Assert.AreEqual (false, p.CausesValidation, "A15");
218 public void AddAttributesToRender ()
220 Poker p = new Poker ();
221 ListItem foo = new ListItem ("foo");
222 ListItem bar = new ListItem ("bar");
226 string orig = "<select type=\"MyType\" name=\"MyName\" value=\"MyValue\"><option value=\"foo\">foo</option><option value=\"bar\">bar</option></select>";
228 string html = p.Render ();
229 HtmlDiff.AssertAreEqual(orig,html,"AddAttributesToRender failed");
233 public void AppendDataBoundItems ()
235 ListControlPoker p = new ListControlPoker ();
236 ListItem foo = new ListItem ("foo");
237 ListItem bar = new ListItem ("bar");
240 Assert.AreEqual (2, p.Items.Count, "Before databound");
241 p.AppendDataBoundItems = true; // Not to clear list before databind
242 p.DataSource = Databound ();
244 Assert.AreEqual (5, p.Items.Count, "After databound");
245 p.AppendDataBoundItems = false; // To clear list before databind
247 Assert.AreEqual (3, p.Items.Count, "Clear list and databound");
250 ArrayList Databound ()
252 ArrayList list = new ArrayList ();
260 [Category ("NunitWeb")]
261 public void CausesValidation_ValidationGroup ()
263 WebTest t = new WebTest ("ListControlPage.aspx");
264 string str = t.Run ();
265 FormRequest fr = new FormRequest (t.Response, "form1");
266 fr.Controls.Add ("__EVENTTARGET");
267 fr.Controls.Add ("__EVENTARGUMENT");
268 fr.Controls.Add ("ListBox1");
269 fr.Controls["__EVENTTARGET"].Value = "ListBox1";
270 fr.Controls["__EVENTARGUMENT"].Value = "";
271 fr.Controls["ListBox1"].Value = "2";
273 string html = t.Run ();
275 if (html.IndexOf ("Validate_validation_group") == -1)
276 Assert.Fail ("Validate not created");
277 if (html.IndexOf ("MyValidationGroup") == -1)
278 Assert.Fail ("Wrong validation group");
282 public void OnTextChanged ()
284 ListControlPoker p = new ListControlPoker ();
285 p.TextChanged += new EventHandler (p_TextChanged);
286 Assert.AreEqual (false, eventTextChanged, "Before");
287 p.OnTextChanged (new EventArgs ());
288 Assert.AreEqual (true, eventTextChanged, "After");
291 bool eventTextChanged;
292 void p_TextChanged (object sender, EventArgs e)
294 eventTextChanged = true;
298 public void PerformDataBind_PerformSelect ()
300 Poker p = new Poker ();
302 string html = p.Render ();
304 string orig = @"<select type=""MyType"" name=""MyName"" value=""MyValue"">
305 <option selected=""selected"" value=""1"">1</option>
306 <option value=""2"">2</option>
307 <option value=""3"">3</option>
310 HtmlDiff.AssertAreEqual (orig, html, "PerformDataBind");
314 [Category("NotWorking")] //Not implemented
315 public void SetPostDataSelection ()
317 Poker p = new Poker ();
318 ListItem foo = new ListItem ("foo");
319 ListItem bar = new ListItem ("bar");
322 p.SetPostDataSelection (1);
323 Assert.AreEqual (1, p.SelectedIndex, "SetPostDataSelection");
329 Poker p = new Poker ();
330 ListItem foo = new ListItem ("foo");
331 ListItem bar = new ListItem ("bar");
334 Assert.AreEqual (string.Empty, p.Text, "Text#1");
336 Assert.AreEqual ("bar", p.Text, "Text#2");
339 #region HelpListForMultiple
340 class PokerL : ListBox
344 InitializeMyListBox ();
346 private void InitializeMyListBox ()
348 // Add items to the ListBox.
357 // Set the SelectionMode to select multiple items.
358 SelectionMode = ListSelectionMode.Multiple;
360 Items[0].Selected = true;
361 Items[2].Selected = true;
364 public void TrackState ()
369 public object SaveState ()
371 return SaveViewState ();
374 public void LoadState (object state)
376 LoadViewState (state);
379 public object ViewStateValue (string name)
381 return ViewState[name];
384 public string Render ()
386 StringWriter sw = new StringWriter ();
388 HtmlTextWriter writer = new HtmlTextWriter (sw);
389 base.Render (writer);
390 return writer.InnerWriter.ToString ();
395 public void Multiple ()
397 PokerL p = new PokerL ();
398 Assert.AreEqual (true, p.Items[0].Selected, "MultipleSelect#1");
399 Assert.AreEqual (true, p.Items[2].Selected, "MultipleSelect#2");
400 string html = p.Render ();
402 string orig = @"<select size=""4"" multiple=""multiple"">
403 <option selected=""selected"" value=""A"">A</option>
404 <option value=""C"">C</option>
405 <option selected=""selected"" value=""E"">E</option>
406 <option value=""F"">F</option>
407 <option value=""G"">G</option>
408 <option value=""D"">D</option>
409 <option value=""B"">B</option>
412 HtmlDiff.AssertAreEqual (orig, html, "MultipleSelect#3");
419 public void CleanProperties ()
421 ListControlPoker p = new ListControlPoker ();
423 p.AutoPostBack = true;
424 Assert.AreEqual (p.AutoPostBack, true, "A2");
426 p.DataMember = "DataMember";
427 Assert.AreEqual (p.DataMember, "DataMember", "A3");
429 p.DataSource = "DataSource";
430 Assert.AreEqual (p.DataSource, "DataSource", "A4");
432 p.DataTextField = "DataTextField";
433 Assert.AreEqual (p.DataTextField, "DataTextField", "A5");
435 p.DataTextFormatString = "DataTextFormatString";
436 Assert.AreEqual (p.DataTextFormatString, "DataTextFormatString", "A6");
438 p.DataValueField = "DataValueField";
439 Assert.AreEqual (p.DataValueField, "DataValueField", "A7");
441 p.SelectedIndex = 10;
442 Assert.AreEqual (p.SelectedIndex, -1, "A8");
444 p.SelectedValue = "SelectedValue";
445 Assert.AreEqual (p.SelectedValue, String.Empty, "A9");
449 public void NullProperties ()
451 ListControlPoker p = new ListControlPoker ();
454 Assert.AreEqual (p.DataMember, String.Empty, "A1");
457 Assert.AreEqual (p.DataSource, null, "A2");
459 p.DataTextField = null;
460 Assert.AreEqual (p.DataTextField, String.Empty, "A3");
462 p.DataTextFormatString = null;
463 Assert.AreEqual (p.DataTextFormatString, String.Empty, "A4");
465 p.DataValueField = null;
466 Assert.AreEqual (p.DataValueField, String.Empty, "A5");
468 p.SelectedValue = null;
469 Assert.AreEqual (p.SelectedValue, String.Empty, "A6");
473 public void ClearSelection ()
475 ListControlPoker p = new ListControlPoker ();
477 ListItem foo = new ListItem ("foo");
478 ListItem bar = new ListItem ("bar");
480 BeginIndexChanged (p);
486 // sanity for the real test
487 Assert.AreEqual (p.Items.Count, 2, "A1");
488 Assert.AreEqual (p.SelectedIndex, 1, "A2");
489 Assert.AreEqual (p.SelectedItem, bar, "A3");
490 Assert.AreEqual (p.SelectedValue, bar.Value, "A4");
494 Assert.AreEqual (p.SelectedIndex, -1, "A5");
495 Assert.AreEqual (p.SelectedItem, null, "A6");
496 Assert.AreEqual (p.SelectedValue, String.Empty, "A7");
497 Assert.IsFalse (EndIndexChanged (p), "A8");
499 // make sure we are still sane
500 Assert.AreEqual (p.Items.Count, 2, "A9");
505 // Tests Save/Load ControlState
506 public void ControlState ()
508 ListControlPoker a = new ListControlPoker ();
509 ListControlPoker b = new ListControlPoker ();
522 Assert.AreEqual (-1, b.SelectedIndex, "A1");
527 // Tests Save/Load/Track ViewState
528 public void ViewState ()
530 ListControlPoker a = new ListControlPoker ();
531 ListControlPoker b = new ListControlPoker ();
535 BeginIndexChanged (a);
536 BeginIndexChanged (b);
543 object state = a.SaveState ();
546 Assert.AreEqual (2, b.SelectedIndex, "A1");
547 Assert.AreEqual (b.Items.Count, 3, "A2");
549 Assert.AreEqual (b.Items [0].Value, "a", "A3");
550 Assert.AreEqual (b.Items [1].Value, "b", "A4");
551 Assert.AreEqual (b.Items [2].Value, "c", "A5");
553 Assert.IsFalse (EndIndexChanged (a), "A6");
554 Assert.IsFalse (EndIndexChanged (b), "A7");
558 // Tests Save/Load/Track ViewState
559 public void ViewStateNotNeeded ()
561 ListControlPoker a = new ListControlPoker ();
567 object state = a.SaveState ();
568 Assert.AreEqual (null, state, "A1");
572 public void ViewStateContents ()
574 ListControlPoker p = new ListControlPoker ();
578 // So the selected index can be set
582 p.AutoPostBack = false;
583 p.DataMember = "DataMember";
584 p.DataSource = "DataSource";
585 p.DataTextField = "DataTextField";
586 p.DataTextFormatString = "DataTextFormatString";
587 p.DataValueField = "DataValueField";
590 p.AppendDataBoundItems = true;
594 Assert.AreEqual (p.ViewStateValue ("AutoPostBack"), false, "A1");
595 Assert.AreEqual (p.ViewStateValue ("DataMember"), "DataMember", "A2");
597 Assert.AreEqual (p.ViewStateValue ("DataSource"), null, "A3");
598 Assert.AreEqual (p.ViewStateValue ("DataTextField"), "DataTextField", "A4");
599 Assert.AreEqual (p.ViewStateValue ("DataTextFormatString"),
600 "DataTextFormatString", "A5");
601 Assert.AreEqual (p.ViewStateValue ("DataValueField"), "DataValueField", "A6");
604 Assert.AreEqual (p.ViewStateValue ("AppendDataBoundItems"), true, "A7");
607 // None of these are saved
608 Assert.AreEqual (p.ViewStateValue ("SelectedIndex"), null, "A8");
609 Assert.AreEqual (p.ViewStateValue ("SelectedItem"), null, "A9");
610 Assert.AreEqual (p.ViewStateValue ("SelectedValue"), null, "A10");
612 Assert.AreEqual (p.ViewStateValue ("Text"), null, "A11");
618 public void SelectedIndex ()
620 ListControlPoker p = new ListControlPoker ();
624 p.Items.Add ("three");
625 p.Items.Add ("four");
627 p.Items [2].Selected = true;
628 p.Items [1].Selected = true;
630 Assert.AreEqual (p.SelectedIndex, 1, "A1");
633 p.Items [3].Selected = true;
635 Assert.AreEqual (p.SelectedIndex, 3, "A2");
638 Assert.AreEqual (p.SelectedIndex, 1, "A3");
639 Assert.IsFalse (p.Items [3].Selected, "A4");
643 public void Render ()
645 ListControlPoker p = new ListControlPoker ();
647 string s = p.Render ();
648 string expected = "<select>\n\n</select>";
649 Assert.AreEqual (s, expected, "A1");
654 [ExpectedException (typeof (ArgumentOutOfRangeException))]
656 public void ItemsTooHigh ()
658 ListControlPoker l = new ListControlPoker ();
663 Assert.AreEqual (-1, l.SelectedIndex, "#01");
668 [ExpectedException (typeof (ArgumentOutOfRangeException))]
669 public void ItemsTooLow ()
671 ListControlPoker l = new ListControlPoker ();
674 l.SelectedIndex = -2;
678 public void ItemsOk ()
680 ListControlPoker l = new ListControlPoker ();
684 l.SelectedIndex = -1;
688 public void DataBinding1 ()
690 ListControlPoker p = new ListControlPoker ();
691 ArrayList list = new ArrayList ();
697 Assert.AreEqual (-1, p.SelectedIndex, "#01");
699 Assert.AreEqual (2, p.SelectedIndex, "#02");
700 Assert.AreEqual (3.ToString (), p.SelectedValue, "#03");
704 [ExpectedException (typeof (ArgumentException))] // The SelectedIndex and SelectedValue are mutually exclusive
705 public void DataBinding2 ()
707 ListControlPoker p = new ListControlPoker ();
708 ArrayList list = new ArrayList ();
714 p.SelectedValue = "3";
719 public void DataBinding3 ()
721 ListControlPoker p = new ListControlPoker ();
722 ArrayList list = new ArrayList ();
727 // If Index and Value are used, everything's ok if they are selecting
730 p.SelectedValue = "3";
731 Assert.AreEqual ("", p.SelectedValue, "#01");
733 Assert.AreEqual ("3", p.SelectedValue, "#02");
737 [ExpectedException (typeof (NullReferenceException))]
738 public void DataBinding4 ()
740 ListControlPoker p = new ListControlPoker ();
741 ArrayList list = new ArrayList ();
750 public void DataBinding6 () {
751 ListControlPoker p = new ListControlPoker ();
752 ArrayList list = new ArrayList ();
758 Assert.AreEqual (3, p.Items.Count, "#01");
761 Assert.AreEqual (3, p.Items.Count, "#01");
766 public void DataBinding7 () {
767 ListControlPoker p = new ListControlPoker ();
768 ArrayList list = new ArrayList ();
775 p.SelectedValue = "3";
776 Assert.AreEqual (2, p.SelectedIndex, "#01");
779 Assert.AreEqual ("3", p.SelectedValue, "#02");
780 Assert.AreEqual (2, p.SelectedIndex, "#03");
784 [ExpectedException (typeof (ArgumentOutOfRangeException))]
785 public void DataBinding8 () {
786 ListControlPoker p = new ListControlPoker ();
787 ArrayList list = new ArrayList ();
794 p.SelectedValue = "3";
795 Assert.AreEqual (2, p.SelectedIndex, "#01");
797 list = new ArrayList ();
803 Assert.AreEqual ("3", p.SelectedValue, "#01");
804 Assert.AreEqual (2, p.SelectedIndex, "#01");
808 [ExpectedException (typeof (ArgumentOutOfRangeException))]
809 public void DataBinding9 () {
810 ListControlPoker p = new ListControlPoker ();
811 ArrayList list = new ArrayList ();
816 p.SelectedValue = "5";
821 public void DataBinding1a () {
822 ListControlPoker p = new ListControlPoker ();
823 ArrayList list = new ArrayList ();
829 Assert.AreEqual (-1, p.SelectedIndex, "#01");
831 Assert.AreEqual (-1, p.SelectedIndex, "#02");
832 Assert.AreEqual ("", p.SelectedValue, "#03");
836 public void DataBinding10 () {
837 ListControlPoker p = new ListControlPoker ();
838 ArrayList list = new ArrayList ();
845 p.SelectedValue = "5";
846 Assert.AreEqual ("", p.SelectedValue, "#01");
849 Assert.AreEqual (-1, p.SelectedIndex, "#02");
853 public void DataBinding11 () {
854 ListControlPoker p = new ListControlPoker ();
855 ArrayList list = new ArrayList ();
860 p.SelectedValue = "3";
863 p.SelectedValue = "5";
864 Assert.AreEqual ("3", p.SelectedValue, "#01");
867 Assert.AreEqual (2, p.SelectedIndex, "#02");
870 Assert.AreEqual ("", p.SelectedValue, "#03");
871 Assert.AreEqual (-1, p.SelectedIndex, "#04");
873 p.Items.Add (new ListItem ("1"));
874 p.Items.Add (new ListItem ("2"));
875 p.Items.Add (new ListItem ("3"));
876 p.Items.Add (new ListItem ("4"));
877 p.Items.Add (new ListItem ("5"));
878 Assert.AreEqual ("", p.SelectedValue, "#05");
879 Assert.AreEqual (-1, p.SelectedIndex, "#06");
881 list = new ArrayList ();
889 Assert.AreEqual ("5", p.SelectedValue, "#07");
890 Assert.AreEqual (4, p.SelectedIndex, "#08");
899 public Data (string name, object val)
909 public object Value {
915 public void DataBinding5 ()
917 ListControlPoker p = new ListControlPoker ();
918 p.DataTextField = "Name";
919 p.DataValueField = "Value";
920 ArrayList list = new ArrayList ();
921 list.Add (new Data ("uno", 1));
922 list.Add (new Data ("dos", 2));
923 list.Add (new Data ("tres", 3));
927 Assert.AreEqual (3.ToString (), p.SelectedValue, "#01");
928 Assert.AreEqual ("tres", p.SelectedItem.Text, "#01");
932 public void DataBindingFormat1 ()
934 ListControlPoker p = new ListControlPoker ();
935 ArrayList list = new ArrayList ();
940 p.DataTextFormatString = "{0:00}";
943 Assert.AreEqual ("3", p.SelectedValue, "#01");
947 public void DataBindingFormat2 ()
949 ListControlPoker p = new ListControlPoker ();
950 ArrayList list = new ArrayList ();
955 p.DataTextFormatString = "{0:00}";
958 Assert.IsNotNull (p.SelectedItem, "#00");
959 Assert.AreEqual ("03", p.SelectedItem.Text, "#01");
963 [ExpectedException (typeof (NullReferenceException))]
964 public void DataBindingFormat3 ()
966 ListControlPoker p = new ListControlPoker ();
967 ArrayList list = new ArrayList ();
972 p.DataTextFormatString = "{0:00}";
977 private void BeginIndexChanged (ListControl l)
979 l.SelectedIndexChanged += new EventHandler (IndexChangedHandler);
982 private bool EndIndexChanged (ListControl l)
984 bool res = changed [l] != null;
989 private void IndexChangedHandler (object sender, EventArgs e)
991 changed [sender] = new object ();
995 public void ValueFound1 ()
997 ListControlPoker p = new ListControlPoker ();
999 p.SelectedValue = "one";
1004 [ExpectedException (typeof (ArgumentOutOfRangeException))]
1006 public void ValueNotFound1 ()
1008 ListControlPoker p = new ListControlPoker ();
1009 p.Items.Add ("one");
1010 p.SelectedValue = "dos";
1011 Assert.AreEqual("", p.SelectedValue, "SelectedValue");
1012 Assert.AreEqual(null, p.SelectedItem, "SelectedItem");
1013 Assert.AreEqual(-1, p.SelectedIndex, "SelectedIndex");
1017 public void ValueNotFound2 ()
1019 ListControlPoker p = new ListControlPoker ();
1020 p.SelectedValue = "dos";
1021 Assert.AreEqual("", p.SelectedValue, "SelectedValue");
1022 Assert.AreEqual(null, p.SelectedItem, "SelectedItem");
1023 Assert.AreEqual(-1, p.SelectedIndex, "SelectedIndex");
1027 [ExpectedException (typeof (HttpException))]
1028 public void VerifyMultiSelect_Exception ()
1030 ListControlPoker p = new ListControlPoker ();
1031 p.VerifyMultiSelect ();
1035 public void DataBinding_SelectedValue () {
1036 ListControlPoker p = new ListControlPoker ();
1037 p.SelectedValue = "b";
1039 p.Items.Add (new ListItem ("a", "a"));
1040 p.Items.Add (new ListItem ("b", "b"));
1041 p.Items.Add (new ListItem ("c", "c"));
1043 Assert.IsFalse (p.Items [1].Selected, "SelectedIndex");
1045 Assert.IsTrue (p.Items [1].Selected, "SelectedIndex");
1049 [ExpectedException (typeof (ArgumentOutOfRangeException))]
1050 public void DataBinding_SelectedValue_Exception () {
1051 ListControlPoker p = new ListControlPoker ();
1052 p.SelectedValue = "AAA";
1054 p.Items.Add (new ListItem ("a", "a"));
1055 p.Items.Add (new ListItem ("b", "b"));
1056 p.Items.Add (new ListItem ("c", "c"));
1058 Assert.IsFalse (p.Items [1].Selected, "SelectedIndex");
1060 Assert.IsTrue (p.Items [1].Selected, "SelectedIndex");
1063 [TestFixtureTearDown]
1064 public void TearDown ()