Adjust corlib unit tests to reduce failures when executed on the NET_2_1 profile
authorSebastien Pouliot <sebastien@xamarin.com>
Fri, 9 Sep 2011 17:43:15 +0000 (13:43 -0400)
committerSebastien Pouliot <sebastien@xamarin.com>
Fri, 9 Sep 2011 17:43:15 +0000 (13:43 -0400)
mcs/class/corlib/Test/System.Collections.Generic/ComparerTest.cs
mcs/class/corlib/Test/System.Collections.Generic/ListTest.cs
mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs
mcs/class/corlib/Test/System.Reflection/MonoGenericClassTest.cs
mcs/class/corlib/Test/System.Reflection/ParameterInfoTest.cs
mcs/class/corlib/Test/System.Runtime.InteropServices/RuntimeEnvironmentTest.cs
mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs
mcs/class/corlib/Test/System.Security/HostSecurityManagerTest.cs
mcs/class/corlib/Test/System/EnvironmentTest.cs

index 6e4d80552f34eea5b7e5abab89c91550142a9c19..bb543b3359f8349d817289d3d8a62fe7fda62103 100644 (file)
@@ -40,7 +40,7 @@ namespace MonoTests.System.Collections.Generic
        public class ComparerTest
        {
 
-#if !NET_4_0 // FIXME: the blob contains the 2.0 mscorlib version
+#if !NET_4_0 && !NET_2_1 // FIXME: the blob contains the 2.0 mscorlib version
 
                [Test] // bug #80929
                public void SerializeDefault ()
index 02c1cc4bed4641edcad9a3d6cea01c9ae235b540..78087e25916c5af0ed7758de660f6db6c5285475 100644 (file)
@@ -337,7 +337,7 @@ namespace MonoTests.System.Collections.Generic {
                        Assert.AreEqual (- (l.Count + 1), l.BinarySearch (int.MaxValue));
                }
 
-#if !NET_4_0 // FIXME: the blob contains the 2.0 mscorlib version
+#if !NET_4_0 && !NET_2_1 // FIXME: the blob contains the 2.0 mscorlib version
 
                [Test]
                [Category ("TargetJvmNotWorking")]
index befc725a719e5e9bb655c88b588b0f950ec8e2ab..a7fa213ed3777748890dd2233f053724c8548166 100644 (file)
@@ -127,12 +127,14 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
                        Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
                        Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
+#if !NET_2_1
                        Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
                        // note: mono transforms the CodeBase into uppercase
                        // for net 1.1 which uses file:// and not file:///
                        string codebase = Assembly.GetExecutingAssembly ().CodeBase.ToUpper ().Substring (8);
                        Assert.IsTrue ((isf.AssemblyIdentity.ToString ().ToUpper ().IndexOf (codebase) > 0), "Url");
                        Assert.IsTrue ((isf.AssemblyIdentity.ToString ().ToUpper ().IndexOf (codebase) > 0), "Url");
+#endif
                        Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
                }
 
@@ -160,6 +162,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForDomain ();
                        Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
                        Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
+#if !NET_2_1
                        Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
                        // note: mono transforms the CodeBase into uppercase
                        // for net 1.1 which uses file:// and not file:///
@@ -170,6 +173,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        // so we're using the first parameter to GetCommandLineArgs
                        string exe = Environment.GetCommandLineArgs ()[0].Replace ("\\", "/").ToUpper ();
                        Assert.IsTrue ((isf.DomainIdentity.ToString ().ToUpper ().IndexOf (exe) > 0), exe + "\n" + isf.DomainIdentity.ToString ().ToUpper ()); //"Url - Domain");
+#endif
                        Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
                }
 
@@ -196,12 +200,15 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                {
                        IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication ();
                        Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
+#if !NET_2_1
                        Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
                        Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
                        Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf (Assembly.GetExecutingAssembly ().CodeBase) > 0), "Url");
+#endif
                        Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
                }
-
+               
+#if !NET_2_1
                [Test]
                [ExpectedException (typeof (IsolatedStorageException))]
                public void GetUserStoreForApplication_AssemblyIdentity ()
@@ -218,6 +225,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        object o = isf.DomainIdentity;
                }
 #endif
+#endif
 
 #if NET_4_0
                // This is supposed to be working only in SL.
@@ -235,11 +243,13 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly;
                        IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, typeof (Zone), typeof (Zone));
                        Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
+#if !NET_2_1
                        Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
                        Assert.IsTrue ((isf.AssemblyIdentity is Zone), "AssemblyIdentity");
                        Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf ("MyComputer") > 0), "Zone - Assembly");
                        Assert.IsTrue ((isf.DomainIdentity is Zone), "DomainIdentity");
                        Assert.IsTrue ((isf.DomainIdentity.ToString ().IndexOf ("MyComputer") > 0), "Zone - Domain");
+#endif
                        Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
                }
 
@@ -258,12 +268,14 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, typeof (StrongName), typeof (Url));
                        Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
                        Assert.AreEqual (scope, isf.Scope, "Scope");
+#if !NET_2_1
                        Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
                        // note: mono transforms the CodeBase into uppercase
                        // for net 1.1 which uses file:// and not file:///
                        string codebase = Assembly.GetExecutingAssembly ().CodeBase.ToUpper ().Substring (8);
                        Assert.IsTrue ((isf.AssemblyIdentity.ToString ().ToUpper ().IndexOf (codebase) > 0), "Url");
                        // DomainIdentity throws a InvalidOperationException
+#endif
                        Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
                }
 
@@ -348,10 +360,12 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 
                        // Maximum size for Internet isn't (by default) Int64.MaxValue
                        Assert.AreEqual (scope, isf.Scope, "Scope");
+#if !NET_2_1
                        Assert.IsTrue ((isf.AssemblyIdentity is Zone), "AssemblyIdentity");
                        Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf ("Intranet") > 0), "Zone - Assembly");
                        Assert.IsTrue ((isf.DomainIdentity is Zone), "DomainIdentity");
                        Assert.IsTrue ((isf.DomainIdentity.ToString ().IndexOf ("Internet") > 0), isf.DomainIdentity.ToString ()); //"Zone - Domain");
+#endif
                        Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
                }
 
@@ -439,7 +453,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                                try {
                                        isf.CreateDirectory (path);
                                }
-#if NET_4_0
+#if NET_4_0 || NET_2_1
                                catch (IsolatedStorageException ex) {
                                        Assert.IsFalse (ex.Message.IndexOf (path) >= 0, "Message");
                                        Assert.IsNull (ex.InnerException, "InnerException");
@@ -480,7 +494,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                }
 
                [Test]
-#if NET_4_0
+#if NET_4_0 || NET_2_1
                [ExpectedException (typeof (ArgumentException))]
 #else
                [ExpectedException (typeof (SecurityException))]
@@ -580,8 +594,10 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                {
                        IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Roaming | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain;
                        IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, null, null);
+#if !NET_2_1
                        Assert.AreEqual (typeof (Url), isf.AssemblyIdentity.GetType (), "AssemblyIdentity");
                        Assert.AreEqual (typeof (Url), isf.DomainIdentity.GetType (), "DomainIdentity");
+#endif
                }
 
                [Test]
index 9116054f10c16683ef6ddf2a9d68be7545bda5ef..008c53629e41f5bdaf535232bcfa376ef8d6fbb6 100644 (file)
@@ -69,12 +69,12 @@ namespace MonoTests.System.Reflection.Emit
 #if NET_4_0
                        Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", inst.FullName, "#3");
                        Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
-
+#elif NET_2_1
+                       Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]", inst.FullName, "#3");
+                       Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
 #else
-
                        Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", inst.FullName, "#3");
                        Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
-
 #endif
                        Assert.AreEqual ("foo.type[System.Double,System.String]", inst.ToString (), "#5");
                }
index fd6f4884a3a20cc69cd2cd603c1145d8e740a21b..20e5b8c8f65f31bbb0c11f2a8cd7ac7c7ebbedb6 100644 (file)
@@ -73,7 +73,7 @@ namespace MonoTests.System.Reflection
                        }
                }
 
-#if NET_2_0
+#if NET_2_0 && !NET_2_1
                public enum ParamEnum {
                        None = 0,
                        Foo = 1,
index 3cb98985f228b083f64e0d0cd6c36aec679759d7..e1b841c6f724f5f5ecd0c2e461fd0e69abb6b076 100644 (file)
@@ -55,6 +55,9 @@ namespace MonoTests.System.Runtime.InteropServices {
                }
 
                [Test]
+#if NET_2_1
+               [Ignore ("There's no GAC for the NET_2_1 based profiles (Moonlight, MonoTouch and Mono for Android")]
+#endif
                public void FromGlobalAccessCache ()
                {
                        Assembly corlib = typeof (int).Assembly;
index 5947bd3f9462842ceaee2f74ef0ed77fb83f3fb1..a307461569d575757e9ea364bc1a84008ae65684 100644 (file)
@@ -103,6 +103,9 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
                }
 
                [Test]
+#if NET_2_1
+               [Ignore ("This constructor always throw a NotSupportedException under NET_2_1 and is useless without CryptoAPI (i.e. outside Windows)")]
+#endif
                public void ConstructorIntPtr ()
                {
                        byte[] cert = { 0x30,0x82,0x01,0xFF,0x30,0x82,0x01,0x6C,0x02,0x05,0x02,0x72,0x00,0x06,0xE8,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x30,0x5F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x0A,0x13,0x17,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x0B,0x13,0x25,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,
index db368d06406938a58941a02100b9e73d59ae61b0..f5b2d3e922c4ea91a6ff31bdeaa9e4f888a67492 100644 (file)
@@ -136,6 +136,9 @@ public class CryptoConfigTest {
        // additional names (URL) used for XMLDSIG (System.Security.Cryptography.Xml)
        // URL taken from http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/
        [Test]
+#if NET_2_1
+       [Ignore ("System.Security.dll is not part of Moonlight, MonoTouch and Mono for Android")]
+#endif
        public void CreateFromURL () 
        {
                // URL used in SignatureMethod element
index 321e085affd928bea52c4c2105625e655660b79e..91a65d3ae7084af89b0b940e302ba54a2d7c746d 100644 (file)
@@ -26,7 +26,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
+// NET_2_1 profile lacks some (of the few) CAS features required to execute those tests
+#if NET_2_0 && !NET_2_1
 
 using NUnit.Framework;
 using System;
index be780fdc799cb65b0bd35468909e5e9a128b213c..794e587ff3ab1875f304dc14f3d9005125acae60 100644 (file)
@@ -128,7 +128,7 @@ namespace MonoTests.System
                        Assert.IsFalse (d.IsSynchronized, "IsSynchronized");
                }
 
-#if NET_2_0 && !TARGET_JVM
+#if NET_2_0 && !TARGET_JVM && !NET_2_1
                [Test] // bug #333740
                public void GetEnvironmentVariables_NewlySet ()
                {
@@ -151,7 +151,7 @@ namespace MonoTests.System
                        Assert.IsNotNull (args [0], "application");
                }
 
-#if NET_2_0
+#if NET_2_0 && !NET_2_1
                [Test]
                [ExpectedException (typeof (ArgumentException))]
                public void GetEnvironmentVariable_Target_Invalid ()