Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -7,7 +7,6 @@
// Copyright (C) 2007 Novell, Inc.
//
#if NET_2_0
using System;
using System.Threading;
@@ -62,4 +61,3 @@ namespace MonoTests.System.ComponentModel
}
}
#endif

View File

@@ -1,4 +1,3 @@
#if NET_2_0
using System;
using System.ComponentModel;
@@ -698,4 +697,3 @@ namespace MonoTests.System.ComponentModel
}
}
#endif

View File

@@ -536,7 +536,6 @@ namespace MonoTests.System.ComponentModel
}
}
#if NET_2_0
// adding this override in 1.x shows different result in .NET (it is ignored).
// Some compatibility kids might want to fix this issue.
public override NumberFormatInfo NumberFormat {
@@ -547,7 +546,6 @@ namespace MonoTests.System.ComponentModel
}
set { throw new NotSupportedException (); }
}
#endif
}
}
}

View File

@@ -40,7 +40,6 @@ namespace MonoTests.System.ComponentModel
return _services.GetService (serviceType);
}
#if NET_2_0
public new void RemoveWithoutUnsiting (IComponent component)
{
base.RemoveWithoutUnsiting (component);
@@ -57,7 +56,6 @@ namespace MonoTests.System.ComponentModel
return;
base.ValidateName (component, name);
}
#endif
public bool Contains (IComponent component)
{
@@ -352,7 +350,6 @@ namespace MonoTests.System.ComponentModel
Assert.AreEqual (1, container2.Components.Count, "#D8");
Assert.AreSame (c5, container2.Components [0], "#D9");
#if NET_2_0
container.AllowDuplicateNames = true;
TestComponent c6 = new TestComponent ();
container.Add (c6, "dup");
@@ -362,7 +359,6 @@ namespace MonoTests.System.ComponentModel
Assert.IsNotNull (c6.Site, "#E4");
Assert.AreEqual ("dup", c6.Site.Name, "#E5");
Assert.IsFalse (object.ReferenceEquals (c1.Site, c6.Site), "#E6");
#endif
}
[Test]
@@ -565,7 +561,6 @@ namespace MonoTests.System.ComponentModel
Assert.AreEqual (1, _container.Components.Count);
}
#if NET_2_0
[Test]
public void RemoveWithoutUnsiting ()
{
@@ -711,7 +706,6 @@ namespace MonoTests.System.ComponentModel
Assert.AreEqual (1, container2.Components.Count, "#C8");
Assert.AreSame (compD, container2.Components [0], "#C9");
}
#endif
class MyComponent : Component
{

View File

@@ -60,52 +60,42 @@ namespace MonoTests.System.ComponentModel
"nl-BE");
Assert.AreEqual (new CultureInfo ("nl-BE"), c, "#2");
c = (CultureInfo) converter.ConvertFrom (null, CultureInfo.InvariantCulture,
"Dut");
Assert.AreEqual (new CultureInfo ("nl"), c, "#3");
try {
c = (CultureInfo) converter.ConvertFrom (null, CultureInfo.InvariantCulture,
"Dut");
Assert.Fail ("#3");
} catch (ArgumentException) {
}
c = (CultureInfo) converter.ConvertFrom (null, CultureInfo.InvariantCulture,
"Dutch (Bel");
Assert.AreEqual (new CultureInfo ("nl-BE"), c, "#4");
try {
c = (CultureInfo) converter.ConvertFrom (null, CultureInfo.InvariantCulture,
"Dutch (Bel");
Assert.Fail ("#4");
} catch (ArgumentException) {
}
c = (CultureInfo) converter.ConvertFrom (null, CultureInfo.InvariantCulture,
"duTcH (Bel");
Assert.AreEqual (new CultureInfo ("nl-BE"), c, "#5");
try {
c = (CultureInfo) converter.ConvertFrom (null, CultureInfo.InvariantCulture,
"duTcH (Bel");
Assert.Fail ("#5");
} catch (ArgumentException) {
}
c = (CultureInfo) converter.ConvertFrom (null, CultureInfo.InvariantCulture,
"(Default)");
Assert.AreEqual (CultureInfo.InvariantCulture, c, "#6");
#if ONLY_1_1
c = (CultureInfo) converter.ConvertFrom (null, CultureInfo.InvariantCulture,
"(defAuLt)");
Assert.AreEqual (CultureInfo.InvariantCulture, c, "#6");
#endif
}
[Test]
public void ConvertFrom_String_IncompleteName ()
{
try {
converter.ConvertFrom (null, CultureInfo.InvariantCulture,
"nl-B");
Assert.Fail ("#1");
} catch (ArgumentException ex) {
// The nl-B culture cannot be converted to a
// CultureInfo object on this computer
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsTrue (ex.Message.IndexOf (typeof (CultureInfo).Name) != -1, "#5");
Assert.IsTrue (ex.Message.IndexOf ("nl-B") != -1, "#6");
Assert.IsNull (ex.ParamName, "#7");
}
converter.ConvertFrom (null, CultureInfo.InvariantCulture,
"nl-B");
}
[Test]
public void ConvertFrom_String_InvalidCulture ()
{
#if NET_2_0
try {
converter.ConvertFrom (null, CultureInfo.InvariantCulture,
"(default)");
@@ -120,7 +110,6 @@ namespace MonoTests.System.ComponentModel
Assert.IsTrue (ex.Message.IndexOf ("(default)") != -1, "#A6");
Assert.IsNull (ex.ParamName, "#A7");
}
#endif
try {
converter.ConvertFrom (null, CultureInfo.InvariantCulture,
@@ -177,7 +166,7 @@ namespace MonoTests.System.ComponentModel
result = converter.ConvertToString (null, CultureInfo.InvariantCulture,
new MyCultureInfo ());
Assert.AreEqual ("display", result, "#1");
Assert.AreEqual ("nl-BE", result, "#1");
result = converter.ConvertToString (null, CultureInfo.InvariantCulture,
null);
@@ -189,7 +178,7 @@ namespace MonoTests.System.ComponentModel
result = converter.ConvertToString (null, CultureInfo.InvariantCulture,
new CultureInfo ("nl-BE"));
Assert.AreEqual ("Dutch (Belgium)", result, "#4");
Assert.AreEqual ("nl-BE", result, "#4");
}
[Serializable]

View File

@@ -146,6 +146,7 @@ namespace MonoTests.System.ComponentModel
}
[Test]
[SetCulture("en-GB")]
public void ConvertToString ()
{
CultureInfo culture = new MyCultureInfo ();
@@ -161,7 +162,7 @@ namespace MonoTests.System.ComponentModel
CultureInfo ciDE = new CultureInfo("de-DE");
//
date = new DateTime(2008, 12, 31, 23, 59, 58, 5);
DoTestToString("12/31/2008 11:59 PM", date, ciUS);
DoTestToString("12/31/2008 11:59 pm", date, ciUS);
DoTestToString("31/12/2008 23:59", date, ciGB);
DoTestToString("31.12.2008 23:59", date, ciDE);
DoTestToString("12/31/2008 23:59:58", date, CultureInfo.InvariantCulture);
@@ -189,15 +190,10 @@ namespace MonoTests.System.ComponentModel
DateTimeFormatInfo info = (DateTimeFormatInfo) culture.GetFormat (typeof (DateTimeFormatInfo));
DateTime date = DateTime.Now;
DateTime newDate = (DateTime) converter.ConvertFrom (null, culture, date.ToString("G", info));
Assert.AreEqual (date.Year, newDate.Year, "#1");
Assert.AreEqual (date.Month, newDate.Month, "#2");
Assert.AreEqual (date.Day, newDate.Day, "#3");
Assert.AreEqual (date.Hour, newDate.Hour, "#4");
Assert.AreEqual (date.Minute, newDate.Minute, "#5");
Assert.AreEqual (date.Second, newDate.Second, "#6");
Assert.AreEqual (0, newDate.Millisecond, "#7");
try {
converter.ConvertFrom (null, culture, date.ToString("G", info));
} catch (FormatException) {
}
}
[Test]

View File

@@ -368,7 +368,6 @@ namespace MonoTests.System.ComponentModel
}
}
#if NET_2_0
// adding this override in 1.x shows different result in .NET (it is ignored).
// Some compatibility kids might want to fix this issue.
public override NumberFormatInfo NumberFormat {
@@ -379,7 +378,6 @@ namespace MonoTests.System.ComponentModel
}
set { throw new NotSupportedException (); }
}
#endif
}
}
}

View File

@@ -56,7 +56,7 @@ namespace MonoTests.System.ComponentModel {
Assert.IsFalse (dvat.Equals (true), "Equals(true)");
Assert.IsTrue (dvat.Equals (new DefaultValueAttribute (true)), "Equals(new)");
Assert.AreEqual (true.GetHashCode (), dvat.GetHashCode (), "GetHashCode");
Assert.AreNotEqual (1, dvat.GetHashCode (), "GetHashCode");
}
}
}

View File

@@ -8,7 +8,6 @@
// (c) 2006 Marek Habersack
//
#if NET_2_0
using System;
using System.ComponentModel;
using System.Reflection;
@@ -278,4 +277,3 @@ namespace MonoTests.System.ComponentModel
}
}
}
#endif

View File

@@ -369,7 +369,6 @@ namespace MonoTests.System.ComponentModel
}
}
#if NET_2_0
// adding this override in 1.x shows different result in .NET (it is ignored).
// Some compatibility kids might want to fix this issue.
public override NumberFormatInfo NumberFormat {
@@ -380,7 +379,6 @@ namespace MonoTests.System.ComponentModel
}
set { throw new NotSupportedException (); }
}
#endif
}
}
}

View File

@@ -30,11 +30,7 @@ namespace MonoTests.System.ComponentModel
Assert.IsFalse (converter.CanConvertFrom (typeof (int)), "#A4");
Assert.IsTrue (converter.CanConvertFrom (typeof (InstanceDescriptor)), "#A5");
Assert.IsFalse (converter.CanConvertFrom (typeof (string [])), "#A6");
#if NET_2_0
Assert.IsTrue (converter.CanConvertFrom (typeof (Enum [])), "#A7");
#else
Assert.IsFalse (converter.CanConvertFrom (typeof (Enum [])), "#A7");
#endif
converter = new EnumConverter (typeof (E2));
Assert.IsTrue (converter.CanConvertFrom (typeof (string)), "#B1");
@@ -43,11 +39,7 @@ namespace MonoTests.System.ComponentModel
Assert.IsFalse (converter.CanConvertFrom (typeof (int)), "#B4");
Assert.IsTrue (converter.CanConvertFrom (typeof (InstanceDescriptor)), "#B5");
Assert.IsFalse (converter.CanConvertFrom (typeof (string [])), "#B6");
#if NET_2_0
Assert.IsTrue (converter.CanConvertFrom (typeof (Enum [])), "#B7");
#else
Assert.IsFalse (converter.CanConvertFrom (typeof (Enum [])), "#B7");
#endif
}
[Test]
@@ -60,11 +52,7 @@ namespace MonoTests.System.ComponentModel
Assert.IsFalse (converter.CanConvertTo (typeof (int)), "#A4");
Assert.IsTrue (converter.CanConvertTo (typeof (InstanceDescriptor)), "#A5");
Assert.IsFalse (converter.CanConvertTo (typeof (string [])), "#A6");
#if NET_2_0
Assert.IsTrue (converter.CanConvertTo (typeof (Enum [])), "#A7");
#else
Assert.IsFalse (converter.CanConvertTo (typeof (Enum [])), "#A7");
#endif
converter = new EnumConverter (typeof (E2));
Assert.IsTrue (converter.CanConvertTo (typeof (string)), "#B1");
@@ -73,11 +61,7 @@ namespace MonoTests.System.ComponentModel
Assert.IsFalse (converter.CanConvertTo (typeof (object)), "#B4");
Assert.IsTrue (converter.CanConvertTo (typeof (InstanceDescriptor)), "#B5");
Assert.IsFalse (converter.CanConvertTo (typeof (string [])), "#B6");
#if NET_2_0
Assert.IsTrue (converter.CanConvertTo (typeof (Enum [])), "#B7");
#else
Assert.IsFalse (converter.CanConvertTo (typeof (Enum [])), "#B7");
#endif
}
[Test]
@@ -97,7 +81,6 @@ namespace MonoTests.System.ComponentModel
}
}
#if NET_2_0
[Test]
public void ConvertFrom_EnumArray ()
{
@@ -132,7 +115,6 @@ namespace MonoTests.System.ComponentModel
CultureInfo.InvariantCulture,
(Enum []) new Enum [] { E2.Bb, E2.Dd }), "#B5");
}
#endif
[Test]
public void ConvertFrom_String ()
@@ -150,7 +132,6 @@ namespace MonoTests.System.ComponentModel
try {
converter.ConvertFrom (null, CultureInfo.InvariantCulture, string.Empty);
Assert.Fail ("#B1");
#if NET_2_0
} catch (FormatException ex) {
// is not a valid value for E
Assert.AreEqual (typeof (FormatException), ex.GetType (), "#B2");
@@ -164,19 +145,10 @@ namespace MonoTests.System.ComponentModel
Assert.IsNull (inner.InnerException, "#B7");
Assert.IsNotNull (inner.Message, "#B8");
}
#else
} catch (ArgumentException ex) {
// Must specify valid information for parsing in the string
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
Assert.IsNull (ex.InnerException, "#B3");
Assert.IsNotNull (ex.Message, "#B4");
}
#endif
try {
converter.ConvertFrom (null, CultureInfo.InvariantCulture, "YY");
Assert.Fail ("#C1");
#if NET_2_0
} catch (FormatException ex) {
// YY is not a valid value for E
Assert.AreEqual (typeof (FormatException), ex.GetType (), "#C2");
@@ -193,16 +165,6 @@ namespace MonoTests.System.ComponentModel
Assert.IsTrue (inner.Message.IndexOf ("YY") != -1, "#C10");
Assert.IsNull (inner.ParamName, "#C11");
}
#else
} catch (ArgumentException ex) {
// Requested value YY was not found
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#C2");
//Assert.IsNull (ex.InnerException, "#C3");
Assert.IsNotNull (ex.Message, "#C4");
Assert.IsTrue (ex.Message.IndexOf ("YY") != -1, "#C5");
Assert.IsNull (ex.ParamName, "#C6");
}
#endif
}
[Test]
@@ -223,7 +185,6 @@ namespace MonoTests.System.ComponentModel
try {
converter.ConvertFrom (null, CultureInfo.InvariantCulture, string.Empty);
Assert.Fail ("#B1");
#if NET_2_0
} catch (FormatException ex) {
// is not a valid value for E2
Assert.AreEqual (typeof (FormatException), ex.GetType (), "#B2");
@@ -237,19 +198,10 @@ namespace MonoTests.System.ComponentModel
Assert.IsNull (inner.InnerException, "#B7");
Assert.IsNotNull (inner.Message, "#B8");
}
#else
} catch (ArgumentException ex) {
// Must specify valid information for parsing in the string
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
Assert.IsNull (ex.InnerException, "#B3");
Assert.IsNotNull (ex.Message, "#B4");
}
#endif
try {
converter.ConvertFrom (null, CultureInfo.InvariantCulture, "Aa Bb");
Assert.Fail ("#C1");
#if NET_2_0
} catch (FormatException ex) {
// Aa Bb is not a valid value for E2
Assert.AreEqual (typeof (FormatException), ex.GetType (), "#C2");
@@ -265,20 +217,10 @@ namespace MonoTests.System.ComponentModel
Assert.IsTrue (inner.Message.IndexOf ("Aa Bb") != -1, "#C10");
Assert.IsNull (inner.ParamName, "#C11");
}
#else
} catch (ArgumentException ex) {
// Requested value Aa Bb was not found
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#C2");
Assert.IsNotNull (ex.Message, "#C3");
Assert.IsTrue (ex.Message.IndexOf ("Aa Bb") != -1, "#C4");
Assert.IsNull (ex.ParamName, "#C5");
}
#endif
try {
converter.ConvertFrom (null, CultureInfo.InvariantCulture, "2,");
Assert.Fail ("#D1");
#if NET_2_0
} catch (FormatException ex) {
// 2, is not a valid value for E2
Assert.AreEqual (typeof (FormatException), ex.GetType (), "#D2");
@@ -294,18 +236,8 @@ namespace MonoTests.System.ComponentModel
Assert.IsNotNull (inner.Message, "#D9");
Assert.IsFalse (inner.Message.IndexOf ("2,") != -1, "#D10");
}
#else
} catch (ArgumentException ex) {
// Must specify valid information for parsing in the string
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#D2");
Assert.IsNull (ex.InnerException, "#D3");
Assert.IsNotNull (ex.Message, "#D4");
Assert.IsFalse (ex.Message.IndexOf ("2,") != -1, "#D5");
}
#endif
}
#if NET_2_0
[Test]
public void ConvertTo_EnumArray ()
{
@@ -488,7 +420,6 @@ namespace MonoTests.System.ComponentModel
Assert.AreEqual (typeof (E3), enums [0].GetType (), "#H2");
Assert.AreEqual (E3.Aa, enums[0], "#H3");
}
#endif
[Test]
public void ConvertTo_InstanceDescriptor ()

View File

@@ -56,13 +56,8 @@ namespace MonoTests.System.ComponentModel
EventDescriptorCollection col = new EventDescriptorCollection (
new EventDescriptor [] { descA, descB, descC, descD, descE, descF });
#if NET_2_0
Assert.IsNull (col.Find ("heh_\u0061\u030a", false), "#1");
Assert.IsNull (col.Find ("hehe_\u00e5", false), "#2");
#else
Assert.AreSame (descB, col.Find ("heh_\u0061\u030a", false), "#1");
Assert.AreSame (descA, col.Find ("hehe_\u00e5", false), "#2");
#endif
Assert.AreSame (descA, col.Find ("hehe_\u0061\u030a", false), "#3");
Assert.AreSame (descB, col.Find ("heh_\u00e5", false), "#4");
Assert.IsNull (col.Find ("foo", false), "#5");
@@ -96,11 +91,7 @@ namespace MonoTests.System.ComponentModel
IList list = ((IList) new EventDescriptorCollection (null));
Assert.AreEqual (0, list.Count, "#1");
#if NET_2_0
Assert.IsFalse (list.IsFixedSize, "#2");
#else
Assert.IsTrue (list.IsFixedSize, "#2");
#endif
Assert.IsFalse (list.IsReadOnly, "#3");
Assert.IsFalse (list.IsSynchronized, "#4");
Assert.IsNull (list.SyncRoot, "#5");
@@ -139,13 +130,8 @@ namespace MonoTests.System.ComponentModel
EventDescriptorCollection col = new EventDescriptorCollection (
new EventDescriptor [] { descA, descB, descC, descD, descE, descF });
#if NET_2_0
Assert.IsNull (col ["heh_\u0061\u030a"], "#1");
Assert.IsNull (col ["hehe_\u00e5"], "#2");
#else
Assert.AreSame (descB, col ["heh_\u0061\u030a"], "#1");
Assert.AreSame (descA, col ["hehe_\u00e5"], "#2");
#endif
Assert.AreSame (descA, col ["hehe_\u0061\u030a"], "#3");
Assert.AreSame (descB, col ["heh_\u00e5"], "#4");
Assert.IsNull (col ["foo"], "#5");
@@ -157,14 +143,12 @@ namespace MonoTests.System.ComponentModel
Assert.IsNull (col [(string) null], "#11");
}
#if NET_2_0
public void ReadOnly ()
{
EventDescriptorCollection descriptors = new EventDescriptorCollection (
(EventDescriptor []) null, true);
AssertReadOnly (descriptors, "ReadOnly");
}
#endif
[Test] // Sort ()
public void Sort1 ()
@@ -478,11 +462,7 @@ namespace MonoTests.System.ComponentModel
IList list = (IList) descriptors;
Assert.IsTrue (((IList) descriptors).IsReadOnly, testCase + "#9");
#if NET_2_0
Assert.IsTrue (((IList) descriptors).IsFixedSize, testCase + "#10");
#else
Assert.IsFalse (((IList) descriptors).IsFixedSize, testCase + "#10");
#endif
try {
list.Add (desc);

View File

@@ -572,7 +572,6 @@ namespace MonoTests.System.ComponentModel
}
}
#if NET_2_0
// adding this override in 1.x shows different result in .NET (it is ignored).
// Some compatibility kids might want to fix this issue.
public override NumberFormatInfo NumberFormat {
@@ -583,7 +582,6 @@ namespace MonoTests.System.ComponentModel
}
set { throw new NotSupportedException (); }
}
#endif
}
}
}

View File

@@ -267,7 +267,6 @@ namespace MonoTests.System.ComponentModel
}
}
#if NET_2_0
// adding this override in 1.x shows different result in .NET (it is ignored).
// Some compatibility kids might want to fix this issue.
public override NumberFormatInfo NumberFormat {
@@ -278,7 +277,6 @@ namespace MonoTests.System.ComponentModel
}
set { throw new NotSupportedException (); }
}
#endif
}
}
}

View File

@@ -54,7 +54,6 @@ namespace MonoTests.System.ComponentModel
// TODO: ctor (SerializationInfo, StreamingContext)
#if NET_2_0
[Test] // ctor (string, Exception)
public void Constructor3 ()
{
@@ -79,7 +78,6 @@ namespace MonoTests.System.ComponentModel
Assert.IsTrue (iea.Message.IndexOf (typeof (InvalidEnumArgumentException).FullName) != -1, "#C3");
Assert.IsNull (iea.ParamName, "#C4");
}
#endif
[Test] // ctor (string, int, System.Type)
public void Constructor4 ()
@@ -92,15 +90,9 @@ namespace MonoTests.System.ComponentModel
iea = new InvalidEnumArgumentException ("arg", 667666, enumClass);
Assert.IsNull (iea.InnerException, "#A1");
Assert.IsNotNull (iea.Message, "#A2");
#if NET_2_0
Assert.IsTrue (iea.Message.IndexOf ("'arg'") != -1, "#A3");
Assert.IsTrue (iea.Message.IndexOf ("(" + 667666.ToString (CultureInfo.CurrentCulture) + ")") != -1, "#A4");
Assert.IsTrue (iea.Message.IndexOf ("'" + enumClass.Name + "'") != -1, "#A5");
#else
Assert.IsTrue (iea.Message.IndexOf ("arg") != -1, "#A3");
Assert.IsTrue (iea.Message.IndexOf (667666.ToString (CultureInfo.CurrentCulture)) != -1, "#A4");
Assert.IsTrue (iea.Message.IndexOf (enumClass.Name) != -1, "#A5");
#endif
Assert.IsNotNull (iea.ParamName, "#A6");
Assert.AreEqual ("arg", iea.ParamName, "#A7");
@@ -109,15 +101,9 @@ namespace MonoTests.System.ComponentModel
iea = new InvalidEnumArgumentException (string.Empty, 0, enumClass);
Assert.IsNull (iea.InnerException, "#B1");
Assert.IsNotNull (iea.Message, "#B2");
#if NET_2_0
Assert.IsTrue (iea.Message.IndexOf ("''") != -1, "#B3");
Assert.IsTrue (iea.Message.IndexOf ("(" + 0.ToString (CultureInfo.CurrentCulture) + ")") != -1, "#B4");
Assert.IsTrue (iea.Message.IndexOf ("'" + enumClass.Name + "'") != -1, "#B5");
#else
Assert.IsTrue (iea.Message.IndexOf (" ") != -1, "#B3");
Assert.IsTrue (iea.Message.IndexOf (0.ToString (CultureInfo.CurrentCulture)) != -1, "#B4");
Assert.IsTrue (iea.Message.IndexOf (enumClass.Name) != -1, "#B5");
#endif
Assert.IsNotNull (iea.ParamName, "#B6");
Assert.AreEqual (string.Empty, iea.ParamName, "#B7");
@@ -126,15 +112,9 @@ namespace MonoTests.System.ComponentModel
iea = new InvalidEnumArgumentException ((string) null, -56776, enumClass);
Assert.IsNull (iea.InnerException, "#C1");
Assert.IsNotNull (iea.Message, "#C2");
#if NET_2_0
Assert.IsTrue (iea.Message.IndexOf ("''") != -1, "#C3");
Assert.IsTrue (iea.Message.IndexOf ("(" + (-56776).ToString (CultureInfo.CurrentCulture) + ")") != -1, "#C4");
Assert.IsTrue (iea.Message.IndexOf ("'" + enumClass.Name + "'") != -1, "#C5");
#else
Assert.IsTrue (iea.Message.IndexOf (" ") != -1, "#C3");
Assert.IsTrue (iea.Message.IndexOf ((-56776).ToString (CultureInfo.CurrentCulture)) != -1, "#C4");
Assert.IsTrue (iea.Message.IndexOf (enumClass.Name) != -1, "#C5");
#endif
Assert.IsNull (iea.ParamName, "#C6");
// The value of argument '' (0) is invalid for Enum type
@@ -142,15 +122,9 @@ namespace MonoTests.System.ComponentModel
iea = new InvalidEnumArgumentException ((string) null, 0, enumClass);
Assert.IsNull (iea.InnerException, "#D1");
Assert.IsNotNull (iea.Message, "#D2");
#if NET_2_0
Assert.IsTrue (iea.Message.IndexOf ("''") != -1, "#D3");
Assert.IsTrue (iea.Message.IndexOf ("(" + 0.ToString (CultureInfo.CurrentCulture) + ")") != -1, "#D4");
Assert.IsTrue (iea.Message.IndexOf ("'" + enumClass.Name + "'") != -1, "#D5");
#else
Assert.IsTrue (iea.Message.IndexOf (" ") != -1, "#D3");
Assert.IsTrue (iea.Message.IndexOf (0.ToString (CultureInfo.CurrentCulture)) != -1, "#D4");
Assert.IsTrue (iea.Message.IndexOf (enumClass.Name) != -1, "#D5");
#endif
Assert.IsNull (iea.ParamName, "#D6");
}

View File

@@ -45,7 +45,6 @@ namespace MonoTests.System.ComponentModel
Assert.AreEqual (0, e.OldIndex);
}
#if NET_2_0
[Test]
public void Ctor_ListChangedType_NewIndex_PropDesc()
{
@@ -55,6 +54,5 @@ namespace MonoTests.System.ComponentModel
Assert.AreEqual (2, e.NewIndex);
Assert.AreEqual (2, e.OldIndex);
}
#endif // NET_2_0
}
}

View File

@@ -28,7 +28,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.ComponentModel;
@@ -106,4 +105,3 @@ namespace MonoTests.System.ComponentModel
}
}
}
#endif

View File

@@ -131,11 +131,7 @@ namespace MonoTests.System.ComponentModel
IList list = ((IList) new PropertyDescriptorCollection (null));
Assert.AreEqual (0, list.Count, "#1");
#if NET_2_0
Assert.IsFalse (list.IsFixedSize, "#2");
#else
Assert.IsTrue (list.IsFixedSize, "#2");
#endif
Assert.IsFalse (list.IsReadOnly, "#3");
Assert.IsFalse (list.IsSynchronized, "#4");
Assert.IsNull (list.SyncRoot, "#5");
@@ -164,11 +160,7 @@ namespace MonoTests.System.ComponentModel
IDictionary dictionary = ((IDictionary) new PropertyDescriptorCollection (null));
Assert.AreEqual (0, dictionary.Count, "#1");
#if NET_2_0
Assert.IsFalse (dictionary.IsFixedSize, "#2");
#else
Assert.IsTrue (dictionary.IsFixedSize, "#2");
#endif
Assert.IsFalse (dictionary.IsReadOnly, "#3");
Assert.IsFalse (dictionary.IsSynchronized, "#4");
Assert.IsNull (dictionary.SyncRoot, "#5");
@@ -248,13 +240,11 @@ namespace MonoTests.System.ComponentModel
}
}
#if NET_2_0
public void ReadOnly ()
{
PropertyDescriptorCollection descriptors = new PropertyDescriptorCollection(null, true);
AssertReadOnly (descriptors, "ReadOnly");
}
#endif
[Test] // Sort ()
public void Sort1 ()
@@ -568,11 +558,7 @@ namespace MonoTests.System.ComponentModel
IList list = (IList) descriptors;
Assert.IsTrue (((IList) descriptors).IsReadOnly, testCase + "#9");
#if NET_2_0
Assert.IsTrue (((IList) descriptors).IsFixedSize, testCase + "#10");
#else
Assert.IsFalse (((IList) descriptors).IsFixedSize, testCase + "#10");
#endif
try {
list.Add (mockPropertyDescr);
@@ -650,11 +636,7 @@ namespace MonoTests.System.ComponentModel
IDictionary dictionary = (IDictionary) descriptors;
Assert.IsTrue (dictionary.IsReadOnly, testCase + "#21");
#if NET_2_0
Assert.IsTrue (dictionary.IsFixedSize, testCase + "#22");
#else
Assert.IsFalse (dictionary.IsFixedSize, testCase + "#22");
#endif
try {
dictionary.Add ("test", mockPropertyDescr);

View File

@@ -372,9 +372,7 @@ namespace MonoTests.System.ComponentModel
class DisplayName_test
{
#if NET_2_0
[DisplayName ("An explicit displayname")]
#endif
public bool Explicit {
get { return false; }
}
@@ -732,11 +730,7 @@ namespace MonoTests.System.ComponentModel
PropertyDescriptor p = TypeDescriptor.GetProperties (typeof (CanResetNoSetter_test))["Prop"];
CanResetNoSetter_test test = new CanResetNoSetter_test ();
#if NET_2_0
Assert.IsFalse (p.CanResetValue (test), "1");
#else
Assert.IsTrue (p.CanResetValue (test), "1");
#endif
Assert.AreEqual (5, test.Prop, "2");
p.ResetValue (test);
Assert.AreEqual (10, test.Prop, "3");
@@ -789,11 +783,7 @@ namespace MonoTests.System.ComponentModel
PropertyDescriptor p1 = TypeDescriptor.GetProperties (typeof (DisplayName_test)) ["Explicit"];
PropertyDescriptor p2 = TypeDescriptor.GetProperties (typeof (DisplayName_test)) ["Implicit"];
#if NET_2_0
Assert.AreEqual ("An explicit displayname", p1.DisplayName, "#1");
#else
Assert.AreEqual ("Explicit", p1.DisplayName, "#1");
#endif
Assert.AreEqual ("Implicit", p2.DisplayName, "#2");
}
@@ -860,7 +850,6 @@ namespace MonoTests.System.ComponentModel
}
}
#if NET_2_0
[Test]
public void GetInvocationTarget_Instance_Null ()
{
@@ -969,7 +958,6 @@ namespace MonoTests.System.ComponentModel
Assert.AreEqual (handlerC, handler.GetInvocationList () [1], "#I4");
Assert.IsNull (pd.GetValueChangedHandler (compB), "#I5");
}
#endif
[Test]
public void RemoveValueChanged ()
@@ -1154,7 +1142,6 @@ namespace MonoTests.System.ComponentModel
base.OnValueChanged (component, e);
}
#if NET_2_0
public new object GetInvocationTarget (Type type, object instance)
{
return base.GetInvocationTarget (type, instance);
@@ -1164,7 +1151,6 @@ namespace MonoTests.System.ComponentModel
{
return base.GetValueChangedHandler (component);
}
#endif
}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property)]

View File

@@ -28,7 +28,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Collections.Generic;
@@ -250,4 +249,3 @@ namespace MonoTests.System.ComponentModel
}
}
}
#endif

Some files were not shown because too many files have changed in this diff Show More