Explorar el Código

In Test/System.ComponentModel:
2006-12-20 Chris Toshok <[email protected]>

* ComplexBindingPropertiesAttributeTest.cs: new tests.

In System.ComponentModel:
2006-12-20 Chris Toshok <[email protected]>

* ComplexBindingPropertiesAttribute.cs: new 2.0 attribute.

In .:
2006-12-20 Chris Toshok <[email protected]>
* System_test.dll.sources: add ComplexBindingPropertiesAttributeTest.cs

* System.dll.sources: add ComplexBindingPropertiesAttribute.cs


svn path=/trunk/mcs/; revision=69842

Chris Toshok hace 19 años
padre
commit
a506c4efe8

+ 5 - 0
mcs/class/System/ChangeLog

@@ -1,3 +1,8 @@
+2006-12-20  Chris Toshok  <[email protected]>
+
+	* System_test.dll.sources: add ComplexBindingPropertiesAttributeTest.cs
+
+	* System.dll.sources: add ComplexBindingPropertiesAttribute.cs
 
 Wed Dec 20 19:30:27 CET 2006 Paolo Molaro <[email protected]>
 

+ 4 - 0
mcs/class/System/System.ComponentModel/ChangeLog

@@ -1,3 +1,7 @@
+2006-12-20  Chris Toshok  <[email protected]>
+
+	* ComplexBindingPropertiesAttribute.cs: new 2.0 attribute.
+
 2006-12-19  Chris Toshok  <[email protected]>
 
 	* PropertyDescriptor.cs: stop crashing on a missing type

+ 79 - 0
mcs/class/System/System.ComponentModel/ComplexBindingPropertiesAttribute.cs

@@ -0,0 +1,79 @@
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+//
+// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+namespace System.ComponentModel 
+{
+	[AttributeUsage (AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
+	public sealed class ComplexBindingPropertiesAttribute : Attribute
+	{
+		string data_source;
+		string data_member;
+
+		public ComplexBindingPropertiesAttribute (string dataSource, string dataMember)
+		{
+			data_source = dataSource;
+			data_member = dataMember;
+		}
+
+		public ComplexBindingPropertiesAttribute (string dataSource)
+		{
+			data_source = dataSource;
+		}
+
+		public ComplexBindingPropertiesAttribute ()
+		{
+		}
+
+		public string DataMember {
+			get { return data_member; }
+		}
+
+		public string DataSource {
+			get { return data_source; }
+		}
+
+		public override bool Equals (object obj)
+		{
+			ComplexBindingPropertiesAttribute a = obj as ComplexBindingPropertiesAttribute;
+			if (a == null)
+				return false;
+
+			return a.DataMember == data_member && a.DataSource == data_source;
+		}
+
+		public override int GetHashCode ()
+		{
+			int hc = string.Concat (data_source, data_member).GetHashCode ();
+			if (hc == 0)
+				return base.GetHashCode ();
+			return hc;
+		}
+	}
+}
+
+
+#endif

+ 1 - 0
mcs/class/System/System.dll.sources

@@ -179,6 +179,7 @@ System.ComponentModel/CollectionChangeAction.cs
 System.ComponentModel/CollectionChangeEventArgs.cs
 System.ComponentModel/CollectionChangeEventHandler.cs
 System.ComponentModel/CollectionConverter.cs
+System.ComponentModel/ComplexBindingPropertiesAttribute.cs
 System.ComponentModel/ComponentCollection.cs
 System.ComponentModel/ComponentConverter.cs
 System.ComponentModel/Component.cs

+ 1 - 0
mcs/class/System/System_test.dll.sources

@@ -108,6 +108,7 @@ System.Collections.Specialized/StringDictionaryTest.cs
 System.ComponentModel/ArrayConverterTests.cs
 System.ComponentModel/ByteConverterTests.cs
 System.ComponentModel/CollectionConverterTest.cs
+System.ComponentModel/ComplexBindingPropertiesAttributeTest.cs
 System.ComponentModel/ContainerTest.cs
 System.ComponentModel/DateTimeConverterTests.cs
 System.ComponentModel/DecimalConverterTests.cs

+ 4 - 0
mcs/class/System/Test/System.ComponentModel/ChangeLog

@@ -1,3 +1,7 @@
+2006-12-20  Chris Toshok  <[email protected]>
+
+	* ComplexBindingPropertiesAttributeTest.cs: new tests.
+
 2006-12-19  Chris Toshok  <[email protected]>
 
 	* PropertyDescriptorTests.cs: add some tests here because we were

+ 84 - 0
mcs/class/System/Test/System.ComponentModel/ComplexBindingPropertiesAttributeTest.cs

@@ -0,0 +1,84 @@
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace MonoTests.System.ComponentModel {
+
+	[TestFixture]
+	public class ComplexBindingPropertiesAttributeTest {
+
+		[Test]
+		public void CtorTest ()
+		{
+			ComplexBindingPropertiesAttribute a;
+
+			a = new ComplexBindingPropertiesAttribute ("source", "member");
+			Assert.AreEqual ("source", a.DataSource, "1");
+			Assert.AreEqual ("member", a.DataMember, "2");
+
+			a = new ComplexBindingPropertiesAttribute ("source");
+			Assert.AreEqual ("source", a.DataSource, "3");
+			Assert.AreEqual (null, a.DataMember, "4");
+
+			a = new ComplexBindingPropertiesAttribute ();
+			Assert.AreEqual (null, a.DataSource, "5");
+			Assert.AreEqual (null, a.DataMember, "6");
+		}
+
+		[Test]
+		public void EqualsTest ()
+		{
+			ComplexBindingPropertiesAttribute a;
+
+			a = new ComplexBindingPropertiesAttribute ("source", "member");
+			Assert.IsFalse (a.Equals (null), "1");
+			Assert.IsFalse (a.Equals (new ComplexBindingPropertiesAttribute ("member", "source")), "2");
+			Assert.IsTrue (a.Equals (new ComplexBindingPropertiesAttribute ("source", "member")), "3");
+		}
+
+		[Test]
+		public void GetHashCodeTest ()
+		{
+			ComplexBindingPropertiesAttribute a;
+
+			a = new ComplexBindingPropertiesAttribute ("source", "member");
+			Assert.IsFalse (0 == a.GetHashCode (), "1");
+
+			a = new ComplexBindingPropertiesAttribute ("source");
+			Assert.IsFalse (0 == a.GetHashCode (), "2");
+
+			a = new ComplexBindingPropertiesAttribute ();
+			Assert.IsFalse (0 == a.GetHashCode (), "3");
+		}
+	}
+
+}
+
+#endif