Ver código fonte

2006-10-29 Igor Zelmanovich <[email protected]>

	* DataBoundControl: fixed: ValidateDataSource allows null as dataSource.


svn path=/trunk/mcs/; revision=67083
Igor Zelmanovich 19 anos atrás
pai
commit
e253084fbb

+ 4 - 0
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog

@@ -1,3 +1,7 @@
+2006-10-29 Igor Zelmanovich <[email protected]>
+
+	* DataBoundControl: fixed: ValidateDataSource allows null as dataSource.
+
 2006-10-29 Igor Zelmanovich <[email protected]>
 
 	* ListControl.cs: fixed: assigning SelectedIndex with too hight value.

+ 2 - 1
mcs/class/System.Web/System.Web.UI.WebControls/DataBoundControl.cs

@@ -155,7 +155,7 @@ namespace System.Web.UI.WebControls {
 
 		protected override void ValidateDataSource (object dataSource)
 		{
-			if (dataSource is IListSource || dataSource is IEnumerable || dataSource is IDataSource)
+			if (dataSource == null || dataSource is IListSource || dataSource is IEnumerable || dataSource is IDataSource)
 				return;
 			throw new ArgumentException ("Invalid data source source type. The data source must be of type IListSource, IEnumerable or IDataSource.");
 		}
@@ -244,3 +244,4 @@ namespace System.Web.UI.WebControls {
 
 
 
+

+ 5 - 0
mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog

@@ -1,3 +1,8 @@
+2006-10-29 Igor Zelmanovich <[email protected]>
+
+	* DataBoundControlTest.cs: new test was added
+	* ListControlTest.cs: removed NotWorking attributes
+			
 2006-10-29 Igor Zelmanovich <[email protected]>
 
 	* ListControlTest.cs: removed NotWorking attributes

+ 12 - 0
mcs/class/System.Web/Test/System.Web.UI.WebControls/DataBoundControlTest.cs

@@ -50,6 +50,11 @@ namespace MonoTests.System.Web.UI.WebControls
 			{
 				Console.WriteLine ("PerformSelect\n{0}", Environment.StackTrace);
 			}
+
+			public void DoValidateDataSource (object dataSource)
+			{
+				ValidateDataSource (dataSource);
+			}
 		}
 
 		class MyDataBoundControl : DataBoundControl
@@ -187,6 +192,13 @@ namespace MonoTests.System.Web.UI.WebControls
 			Assert.AreEqual ("", p.DataMember, "A1");
 			Assert.AreEqual ("", p.DataSourceID, "A2");
 		}
+		
+		[Test]
+		public void ValidateDataSource () {
+			Poker p = new Poker ();
+			// Allows null
+			p.DoValidateDataSource (null);
+		}
 	}
 }
 #endif

+ 1 - 1
mcs/class/System.Web/Test/System.Web.UI.WebControls/ListControlTest.cs

@@ -140,7 +140,6 @@ namespace MonoTests.System.Web.UI.WebControls {
 		}
 
 		[Test]
-        [Category ("NotWorking")]
 		public void NullProperties ()
 		{
 			ListControlPoker p = new ListControlPoker ();
@@ -557,3 +556,4 @@ namespace MonoTests.System.Web.UI.WebControls {
 
 
 
+