Explorar o código

2007-10-29 Jonathan Pobst <[email protected]>

	* DateTimePickerTest.cs: Tests for setting the Value outside the
	range of MinDate and MaxDate.

svn path=/trunk/mcs/; revision=88439
Jonathan Pobst %!s(int64=18) %!d(string=hai) anos
pai
achega
71a2cbda34

+ 5 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog

@@ -1,3 +1,8 @@
+2007-10-29  Jonathan Pobst  <[email protected]>
+
+	* DateTimePickerTest.cs: Tests for setting the Value outside the
+	range of MinDate and MaxDate.
+
 2007-10-16  Gert Driesen  <[email protected]>
 
 	* ButtonBaseTest.cs: Added test for IsDefault.

+ 28 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DateTimePickerTest.cs

@@ -3418,5 +3418,33 @@ namespace MonoTests.System.Windows.Forms {
 			DateTimePicker dt = new DateTimePicker ();
 			dt.Text = "abcdef";
 		}
+
+		[Test]
+#if NET_2_0
+		[ExpectedException (typeof (ArgumentOutOfRangeException))]
+#else
+		[ExpectedException (typeof (ArgumentException))]
+#endif	
+		public void ValueTooBig ()
+		{
+			DateTimePicker dt = new DateTimePicker ();
+			dt.MaxDate = DateTime.Now;
+
+			dt.Value = DateTime.Now.AddDays (3);
+		}
+
+		[Test]
+#if NET_2_0
+		[ExpectedException (typeof (ArgumentOutOfRangeException))]
+#else
+		[ExpectedException (typeof (ArgumentException))]
+#endif
+		public void ValueTooSmall ()
+		{
+			DateTimePicker dt = new DateTimePicker ();
+			dt.MinDate = DateTime.Now;
+
+			dt.Value = DateTime.Now.AddDays (-3);
+		}
 	}
 }