2 // Tests for System.Web.UI.WebControls.SelectedDatesCollection.cs
5 // Jordi Mas i Hernandez (jordi@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 System.Web.UI.WebControls;
32 using NUnit.Framework;
34 using System.Collections;
37 using System.Globalization;
40 namespace MonoTests.System.Web.UI.WebControls
43 public class SelectedDatesCollectionTest {
47 public void SelectedDatesCollectionTest_DefaultValues ()
49 ArrayList list = new ArrayList ();
50 SelectedDatesCollection s = new SelectedDatesCollection (list);
52 Assert.AreEqual (0, s.Count, "A1");
53 Assert.AreEqual (false, s.IsReadOnly, "A2");
54 Assert.AreEqual (false, s.IsSynchronized, "A3");
55 Assert.AreEqual (s, s.SyncRoot, "A4");
63 public void AddMethod ()
65 ArrayList list = new ArrayList ();
66 SelectedDatesCollection s = new SelectedDatesCollection (list);
68 s.Add (DateTime.Today);
69 Assert.AreEqual (true, s.Contains (DateTime.Today), "A1");
70 Assert.AreEqual (1, s.Count, "A2");
72 s.Add (DateTime.Today); // Duplicates are not inserted
73 Assert.AreEqual (1, s.Count, "A2");
80 public void ClearMethod ()
82 ArrayList list = new ArrayList ();
83 SelectedDatesCollection s = new SelectedDatesCollection (list);
85 s.Add (DateTime.Today);
87 Assert.AreEqual (0, s.Count, "A1");
92 public void SelectRangeMethod ()
94 ArrayList list = new ArrayList ();
95 SelectedDatesCollection s = new SelectedDatesCollection (list);
97 s.Add (DateTime.Today);
98 s.Add (DateTime.Today);
99 // Internally clears the list
100 s.SelectRange (new DateTime (2000, 1, 1), new DateTime (2001, 1, 1));
102 Assert.AreEqual (367, s.Count, "A1");
106 public void RemoveMethod ()
108 ArrayList list = new ArrayList ();
109 SelectedDatesCollection s = new SelectedDatesCollection (list);
111 s.Add (DateTime.Today);
112 s.Remove (DateTime.Today);
113 Assert.AreEqual (0, s.Count, "A1");