Explorar o código

Update for mobile profile

Marek Safar %!s(int64=13) %!d(string=hai) anos
pai
achega
afa79435aa
Modificáronse 89 ficheiros con 347 adicións e 153 borrados
  1. 2 1
      mcs/class/corlib/Test/System.Collections.Concurrent/CollectionStressTestHelper.cs
  2. 4 1
      mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs
  3. 5 4
      mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentStackTests.cs
  4. 5 2
      mcs/class/corlib/Test/System.Collections.Concurrent/PartitionerTests.cs
  5. 3 2
      mcs/class/corlib/Test/System.IO/DirectoryInfoTest.cs
  6. 1 1
      mcs/class/corlib/Test/System.IO/DirectoryTest.cs
  7. 5 3
      mcs/class/corlib/Test/System.IO/FileInfoTest.cs
  8. 4 2
      mcs/class/corlib/Test/System.IO/FileStreamTest.cs
  9. 2 1
      mcs/class/corlib/Test/System.IO/FileSystemInfoTest.cs
  10. 2 2
      mcs/class/corlib/Test/System.IO/PathTest.cs
  11. 5 2
      mcs/class/corlib/Test/System.IO/StreamReaderTest.cs
  12. 4 0
      mcs/class/corlib/Test/System.Reflection/AssemblyAlgorithmIdAttributeTest.cs
  13. 3 0
      mcs/class/corlib/Test/System.Reflection/AssemblyConfigurationAttributeTest.cs
  14. 2 0
      mcs/class/corlib/Test/System.Reflection/AssemblyCopyrightAttributeTest.cs
  15. 3 0
      mcs/class/corlib/Test/System.Reflection/AssemblyCultureAttributeTest.cs
  16. 3 0
      mcs/class/corlib/Test/System.Reflection/AssemblyDelaySignAttributeTest.cs
  17. 3 0
      mcs/class/corlib/Test/System.Reflection/AssemblyDescriptionAttributeTest.cs
  18. 4 0
      mcs/class/corlib/Test/System.Reflection/AssemblyFileVersionAttributeTest.cs
  19. 3 0
      mcs/class/corlib/Test/System.Reflection/AssemblyInformationalVersionAttributeTest.cs
  20. 2 2
      mcs/class/corlib/Test/System.Reflection/AssemblyNameTest.cs
  21. 11 4
      mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs
  22. 0 1
      mcs/class/corlib/Test/System.Reflection/CustomAttributeDataTest.cs
  23. 0 3
      mcs/class/corlib/Test/System.Reflection/EventInfoTest.cs
  24. 1 1
      mcs/class/corlib/Test/System.Reflection/FieldInfoTest.cs
  25. 4 2
      mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs
  26. 6 3
      mcs/class/corlib/Test/System.Reflection/ModuleTest.cs
  27. 4 0
      mcs/class/corlib/Test/System.Reflection/MonoGenericClassTest.cs
  28. 0 3
      mcs/class/corlib/Test/System.Reflection/ParameterInfoTest.cs
  29. 4 2
      mcs/class/corlib/Test/System.Reflection/PropertyInfoTest.cs
  30. 1 1
      mcs/class/corlib/Test/System.Reflection/TypeDelegatorTest.cs
  31. 5 0
      mcs/class/corlib/Test/System.Resources/ResourceReaderTest.cs
  32. 2 2
      mcs/class/corlib/Test/System.Resources/ResourceWriterTest.cs
  33. 2 1
      mcs/class/corlib/Test/System.Runtime.InteropServices/GCHandleTest.cs
  34. 12 10
      mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs
  35. 1 6
      mcs/class/corlib/Test/System.Runtime.InteropServices/RuntimeEnvironmentTest.cs
  36. 1 0
      mcs/class/corlib/Test/System.Runtime.Remoting/SynchronizationAttributeTest.cs
  37. 0 16
      mcs/class/corlib/Test/System.Runtime.Serialization/ObjectManagerTest.cs
  38. 3 2
      mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest.cs
  39. 4 0
      mcs/class/corlib/Test/System.Security.AccessControl/MutexSecurityTest.cs
  40. 2 1
      mcs/class/corlib/Test/System.Security.AccessControl/RawSecurityDescriptorTest.cs
  41. 4 0
      mcs/class/corlib/Test/System.Security.AccessControl/RegistrySecurityTest.cs
  42. 4 0
      mcs/class/corlib/Test/System.Security.Cryptography/AesCfbTest.cs
  43. 2 3
      mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs
  44. 3 0
      mcs/class/corlib/Test/System.Security.Permissions/EnvironmentPermissionAttributeTest.cs
  45. 3 0
      mcs/class/corlib/Test/System.Security.Permissions/EnvironmentPermissionTest.cs
  46. 3 0
      mcs/class/corlib/Test/System.Security.Permissions/FileDialogPermissionAttributeTest.cs
  47. 3 0
      mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionAttributeTest.cs
  48. 9 0
      mcs/class/corlib/Test/System.Security.Permissions/HostProtectionAttributeTest.cs
  49. 5 2
      mcs/class/corlib/Test/System.Security.Permissions/IBuiltInPermissionTest.cs
  50. 3 0
      mcs/class/corlib/Test/System.Security.Permissions/PermissionSetAttributeTest.cs
  51. 3 0
      mcs/class/corlib/Test/System.Security.Permissions/ReflectionPermissionAttributeTest.cs
  52. 3 0
      mcs/class/corlib/Test/System.Security.Permissions/SecurityPermissionAttributeTest.cs
  53. 3 0
      mcs/class/corlib/Test/System.Security.Permissions/StrongNameIdentityPermissionAttributeTest.cs
  54. 6 0
      mcs/class/corlib/Test/System.Security.Policy/AllMembershipConditionTest.cs
  55. 6 0
      mcs/class/corlib/Test/System.Security.Policy/ApplicationDirectoryMembershipConditionTest.cs
  56. 1 0
      mcs/class/corlib/Test/System.Security.Policy/EvidenceTest.cs
  57. 6 0
      mcs/class/corlib/Test/System.Security.Policy/GacMembershipConditionTest.cs
  58. 6 0
      mcs/class/corlib/Test/System.Security.Policy/HashMembershipConditionTest.cs
  59. 3 0
      mcs/class/corlib/Test/System.Security.Policy/PolicyLevelTest.cs
  60. 3 0
      mcs/class/corlib/Test/System.Security.Policy/PolicyStatementTest.cs
  61. 9 4
      mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs
  62. 6 0
      mcs/class/corlib/Test/System.Security.Policy/SiteMembershipConditionTest.cs
  63. 3 0
      mcs/class/corlib/Test/System.Security.Policy/StrongNameMembershipConditionTest.cs
  64. 6 0
      mcs/class/corlib/Test/System.Security.Policy/UrlMembershipConditionTest.cs
  65. 6 0
      mcs/class/corlib/Test/System.Security.Policy/ZoneMembershipConditionTest.cs
  66. 1 1
      mcs/class/corlib/Test/System.Security.Principal/NTAccountTest.cs
  67. 1 1
      mcs/class/corlib/Test/System.Security.Principal/SecurityIdentifierTest.cs
  68. 2 1
      mcs/class/corlib/Test/System.Security/PermissionSetTest.cs
  69. 3 3
      mcs/class/corlib/Test/System.Security/SecurityCriticalAttributeTest.cs
  70. 2 2
      mcs/class/corlib/Test/System.Security/SecurityExceptionTest.cs
  71. 13 20
      mcs/class/corlib/Test/System.Security/SecurityManagerTest.cs
  72. 3 0
      mcs/class/corlib/Test/System.Text/ASCIIEncodingTest.cs
  73. 1 0
      mcs/class/corlib/Test/System.Text/UTF8EncodingTest.cs
  74. 4 1
      mcs/class/corlib/Test/System.Threading.Tasks/TaskCompletionSourceTests.cs
  75. 4 1
      mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
  76. 4 1
      mcs/class/corlib/Test/System.Threading.Tasks/TaskSchedulerTest.cs
  77. 1 0
      mcs/class/corlib/Test/System.Threading/ExecutionContextTest.cs
  78. 6 4
      mcs/class/corlib/Test/System.Threading/ThreadLocalTests.cs
  79. 14 4
      mcs/class/corlib/Test/System/ActivatorTest.cs
  80. 7 2
      mcs/class/corlib/Test/System/AppDomainSetupTest.cs
  81. 4 0
      mcs/class/corlib/Test/System/AppDomainTest.cs
  82. 4 2
      mcs/class/corlib/Test/System/AttributeTest.cs
  83. 2 1
      mcs/class/corlib/Test/System/CharCategoryTest.cs
  84. 2 0
      mcs/class/corlib/Test/System/ConsoleTest.cs
  85. 6 4
      mcs/class/corlib/Test/System/DelegateTest.cs
  86. 3 1
      mcs/class/corlib/Test/System/EnvironmentCas.cs
  87. 0 1
      mcs/class/corlib/Test/System/ModuleHandleTest.cs
  88. 9 5
      mcs/class/corlib/Test/System/SingleTest.cs
  89. 14 8
      mcs/class/corlib/Test/System/TypeTest.cs

+ 2 - 1
mcs/class/corlib/Test/System.Collections.Concurrent/CollectionStressTestHelper.cs

@@ -36,6 +36,7 @@ using MonoTests.System.Threading.Tasks;
 
 using NUnit;
 using NUnit.Framework;
+using NUnit.Framework.Constraints;
 
 namespace MonoTests.System.Collections.Concurrent
 {
@@ -118,7 +119,7 @@ namespace MonoTests.System.Collections.Concurrent
 				string expected = range.Aggregate (string.Empty, (acc, v) => acc + v);
 				
 				if (order == CheckOrderingType.DontCare)
-					CollectionAssert.AreEquivalent (expected, actual, "#3");
+					Assert.That (actual, new CollectionEquivalentConstraint (expected), "#3");
 				else 
 					Assert.AreEqual (expected, actual, "#3");
 			}, 1000);

+ 4 - 1
mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs

@@ -32,6 +32,9 @@ using System.Collections.Concurrent;
 
 using NUnit;
 using NUnit.Framework;
+#if !MOBILE
+using NUnit.Framework.SyntaxHelpers;
+#endif
 
 namespace MonoTests.System.Collections.Concurrent
 {
@@ -177,7 +180,7 @@ namespace MonoTests.System.Collections.Concurrent
 				int index = Array.IndexOf (keys, kvp.Key);
 				Assert.AreNotEqual (-1, index, "#a");
 				Assert.AreEqual (index + 1, kvp.Value, "#b");
-				Assert.Less (++occurence[index], 2, "#c");
+				Assert.That (++occurence[index], Is.LessThan (2), "#c");
 			}
 		}
 

+ 5 - 4
mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentStackTests.cs

@@ -28,6 +28,7 @@ using System.Threading;
 using System.Linq;
 using System.Collections.Concurrent;
 using NUnit.Framework;
+using NUnit.Framework.Constraints;
 
 namespace MonoTests.System.Collections.Concurrent
 {
@@ -219,7 +220,7 @@ namespace MonoTests.System.Collections.Concurrent
 		{
 			int[] values = new int[3];
 			Assert.AreEqual (3, stack.TryPopRange (values));
-			CollectionAssert.AreEquivalent (new int[] { 9, 8, 7 }, values);
+			Assert.That (values, new CollectionEquivalentConstraint (new int[] { 9, 8, 7 }));
 			Assert.AreEqual (10 - values.Length, stack.Count);
 			for (int i = 9 - values.Length; i >= 0; i--) {
 				int outValue;
@@ -233,7 +234,7 @@ namespace MonoTests.System.Collections.Concurrent
 		{
 			int[] values = new int[1];
 			Assert.AreEqual (1, stack.TryPopRange (values));
-			CollectionAssert.AreEquivalent (new int[] { 9 }, values);
+			Assert.That (values, new CollectionEquivalentConstraint (new int[] { 9 }));
 			Assert.AreEqual (10 - values.Length, stack.Count);
 			for (int i = 9 - values.Length; i >= 0; i--) {
 				int outValue;
@@ -247,7 +248,7 @@ namespace MonoTests.System.Collections.Concurrent
 		{
 			int[] values = new int[10];
 			Assert.AreEqual (10, stack.TryPopRange (values));
-			CollectionAssert.AreEquivalent (Enumerable.Range (0, 10).Reverse ().ToArray (), values);
+			Assert.That (values, new CollectionEquivalentConstraint (Enumerable.Range (0, 10).Reverse ()));
 			Assert.AreEqual (0, stack.Count);
 		}
 
@@ -256,7 +257,7 @@ namespace MonoTests.System.Collections.Concurrent
 		{
 			int[] values = new int[5];
 			Assert.AreEqual (2, stack.TryPopRange (values, 3, 2));
-			CollectionAssert.AreEquivalent (new int[] { 0, 0, 0, 9, 8 }, values);
+			Assert.That (values, new CollectionEquivalentConstraint (new int[] { 0, 0, 0, 9, 8 }));
 			Assert.AreEqual (8, stack.Count);
 		}
 

+ 5 - 2
mcs/class/corlib/Test/System.Collections.Concurrent/PartitionerTests.cs

@@ -31,6 +31,9 @@ using System.Collections.Generic;
 using System.Collections.Concurrent;
 
 using NUnit.Framework;
+#if !MOBILE
+using NUnit.Framework.SyntaxHelpers;
+#endif
 
 namespace MonoTests.System.Collections.Concurrent
 {
@@ -43,7 +46,7 @@ namespace MonoTests.System.Collections.Concurrent
 			OrderablePartitioner<Tuple<int, int>> partitioner = Partitioner.Create (1, 20, 5);
 			var partitions = partitioner.GetOrderablePartitions (3);
 			Assert.AreEqual (3, partitions.Count);
-			CollectionAssert.AllItemsAreNotNull (partitions);
+			Assert.That (partitions, Is.All.Not.Null);
 			var iterator = partitions[0];			
 			Assert.IsTrue (iterator.MoveNext ());
 			Assert.IsTrue (iterator.Current.Equals (Create (0, 1, 6)));
@@ -64,7 +67,7 @@ namespace MonoTests.System.Collections.Concurrent
 			OrderablePartitioner<Tuple<long, long>> partitioner = Partitioner.Create ((long)1, (long)20, (long)5);
 			var partitions = partitioner.GetOrderablePartitions (3);
 			Assert.AreEqual (3, partitions.Count);
-			CollectionAssert.AllItemsAreNotNull (partitions);
+			Assert.That (partitions, Is.All.Not.Null);
 			var iterator = partitions[0];			
 			Assert.IsTrue (iterator.MoveNext ());
 			Assert.IsTrue (iterator.Current.Equals (CreateL (0, 1, 6)));

+ 3 - 2
mcs/class/corlib/Test/System.IO/DirectoryInfoTest.cs

@@ -1062,6 +1062,7 @@ namespace MonoTests.System.IO
 			Assert.AreEqual (TempFolder + DSC + "ToString.Test", info.ToString ());
 		}
 
+#if !MOBILE
 		[Test]
 		public void Serialization ()
 		{
@@ -1099,7 +1100,7 @@ namespace MonoTests.System.IO
 			Assert.AreEqual (info.Name, clone.Name, "#1");
 			Assert.AreEqual (info.FullName, clone.FullName, "#2");
 		}
-		
+
 		// Needed so that UnixSymbolicLinkInfo doesn't have to
 		// be JITted on windows
 		private void Symlink_helper ()
@@ -1137,7 +1138,7 @@ namespace MonoTests.System.IO
 
 			Symlink_helper ();
 		}
-
+#endif
 		static bool RunningOnUnix {
 			get {
 				int p = (int) Environment.OSVersion.Platform;

+ 1 - 1
mcs/class/corlib/Test/System.IO/DirectoryTest.cs

@@ -314,7 +314,7 @@ public class DirectoryTest
 		Assert.IsFalse (Directory.Exists (null as string));
 	}
 
-#if !TARGET_JVM // We don't support yet the Process class.
+#if !TARGET_JVM && !MOBILE // We don't support yet the Process class.
 	[Test] // bug #78239
 	public void ExistsAccessDenied ()
 	{

+ 5 - 3
mcs/class/corlib/Test/System.IO/FileInfoTest.cs

@@ -139,7 +139,7 @@ namespace MonoTests.System.IO
 			}
 		}
 
-#if NET_2_0
+#if !MOBILE
 		[Test]
 		[Category ("NotWorking")]
 		public void IsReadOnly ()
@@ -853,7 +853,7 @@ namespace MonoTests.System.IO
 			}
 		}
 
-#if NET_2_0
+#if !MOBILE
 		[Test]
 		public void Replace1 ()
 		{
@@ -1270,7 +1270,7 @@ namespace MonoTests.System.IO
 				Assert.IsNotNull (ex.Message, "#4");
 			}
 		}
-			
+#if !MOBILE			
 		[Test]
 		public void Serialization ()
 		{
@@ -1308,8 +1308,10 @@ namespace MonoTests.System.IO
 			Assert.AreEqual (info.Name, clone.Name, "#1");
 			Assert.AreEqual (info.FullName, clone.FullName, "#2");
 		}
+#endif
 
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void ToStringVariety ()
 		{
 			Assert.AreEqual ("foo", new FileInfo ("foo").ToString ());

+ 4 - 2
mcs/class/corlib/Test/System.IO/FileStreamTest.cs

@@ -42,12 +42,13 @@ namespace MonoTests.System.IO
 				Directory.Delete (TempFolder, true);
 
 			Directory.CreateDirectory (TempFolder);
-			
+#if !MOBILE			
 			// from XplatUI.cs
 			IntPtr buf = Marshal.AllocHGlobal (8192);
 			if (uname (buf) == 0)
 				MacOSX = Marshal.PtrToStringAnsi (buf) == "Darwin";
 			Marshal.FreeHGlobal (buf);
+#endif
 		}
 
 		public void TestCtr ()
@@ -1603,7 +1604,7 @@ namespace MonoTests.System.IO
 			Assert.AreEqual (false, File.Exists (path), "DOC#2");
 			
 		}
-
+#if !MOBILE
 		[Test]
 		public void WriteWithExposedHandle ()
 		{
@@ -1637,5 +1638,6 @@ namespace MonoTests.System.IO
 				DeleteFile (path);
 			}
 		}
+#endif
 	}
 }

+ 2 - 1
mcs/class/corlib/Test/System.IO/FileSystemInfoTest.cs

@@ -344,7 +344,7 @@ namespace MonoTests.System.IO
 				DeleteDir (path);
 			}
 		}
-
+#if !MOBILE
 		[Test]
 		public void Serialization ()
 		{
@@ -386,5 +386,6 @@ namespace MonoTests.System.IO
 				DeleteDir (path);
 			}
 		}
+#endif
 	}
 }

+ 2 - 2
mcs/class/corlib/Test/System.IO/PathTest.cs

@@ -1014,7 +1014,7 @@ namespace MonoTests.System.IO
 			string parent = Path.GetFullPath ("..");
 			Assert.IsTrue (!current.EndsWith (".."), "TestCanonicalizeDotst #02");
 		}
-
+#if !MOBILE
 		[Test]
 		public void WindowsSystem32_76191 ()
 		{
@@ -1065,7 +1065,7 @@ namespace MonoTests.System.IO
 				Directory.SetCurrentDirectory (curdir);
 			}
 		}
-
+#endif
 		[Test]
 #if TARGET_JVM
 		[Ignore("Java full (canonical) path always returns windows dir in caps")]

+ 5 - 2
mcs/class/corlib/Test/System.IO/StreamReaderTest.cs

@@ -773,7 +773,8 @@ public class StreamReaderTest
 		return decodedString == TestString;
 	}
     
-    	[Test] // Bug445326
+    [Test] // Bug445326
+	[Category ("MobileNotWorking")]
 	public void EndOfBufferIsCR ()
 	{
 		using (StreamReader reader = new StreamReader ("Test/resources/Fergie.GED")) {
@@ -854,7 +855,9 @@ public class StreamReaderTest
 			}
 		};
 
-		Assert.AreEqual ("ab" + Environment.NewLine, res ().Result);
+		var result = res ();
+		Assert.IsTrue (result.Wait (3000), "#1");
+		Assert.AreEqual ("ab" + Environment.NewLine, result.Result);
 	}
 #endif
 }

+ 4 - 0
mcs/class/corlib/Test/System.Reflection/AssemblyAlgorithmIdAttributeTest.cs

@@ -4,6 +4,9 @@
 //
 // (C) 2004 Ximian, Inc. http://www.ximian.com
 //
+
+#if !MONOTOUCH
+
 using System;
 using System.Threading;
 using System.Reflection;
@@ -84,3 +87,4 @@ namespace MonoTests.System.Reflection {
 	}
 }
 
+#endif

+ 3 - 0
mcs/class/corlib/Test/System.Reflection/AssemblyConfigurationAttributeTest.cs

@@ -5,6 +5,8 @@
 // (C) 2004 Ximian, Inc. http://www.ximian.com
 //
 
+#if !MOBILE
+
 using System;
 using System.Threading;
 using System.Reflection;
@@ -81,3 +83,4 @@ namespace MonoTests.System.Reflection {
 	}
 }
 
+#endif

+ 2 - 0
mcs/class/corlib/Test/System.Reflection/AssemblyCopyrightAttributeTest.cs

@@ -5,6 +5,7 @@
 // (C) 2004 Ximian, Inc. http://www.ximian.com
 //
 
+#if !MOBILE
 using System;
 using System.Threading;
 using System.Reflection;
@@ -81,3 +82,4 @@ namespace MonoTests.System.Reflection {
 	}
 }
 
+#endif

+ 3 - 0
mcs/class/corlib/Test/System.Reflection/AssemblyCultureAttributeTest.cs

@@ -5,6 +5,8 @@
 // (C) 2004 Ximian, Inc. http://www.ximian.com
 //
 
+#if !MOBILE
+
 using System;
 using System.Threading;
 using System.Reflection;
@@ -81,3 +83,4 @@ namespace MonoTests.System.Reflection {
 	}
 }
 
+#endif

+ 3 - 0
mcs/class/corlib/Test/System.Reflection/AssemblyDelaySignAttributeTest.cs

@@ -4,6 +4,8 @@
 //
 // (C) 2004 Ximian, Inc. http://www.ximian.com
 //
+
+#if !MOBILE
 using System;
 using System.Threading;
 using System.Reflection;
@@ -79,3 +81,4 @@ namespace MonoTests.System.Reflection {
 	}
 }
 
+#endif

+ 3 - 0
mcs/class/corlib/Test/System.Reflection/AssemblyDescriptionAttributeTest.cs

@@ -4,6 +4,8 @@
 //
 // (C) 2004 Ximian, Inc. http://www.ximian.com
 //
+
+#if !MOBILE
 using System;
 using System.Threading;
 using System.Reflection;
@@ -80,3 +82,4 @@ namespace MonoTests.System.Reflection {
 	}
 }
 
+#endif

+ 4 - 0
mcs/class/corlib/Test/System.Reflection/AssemblyFileVersionAttributeTest.cs

@@ -4,6 +4,9 @@
 //
 // (C) 2004 Ximian, Inc. http://www.ximian.com
 //
+
+#if !MOBILE
+
 using System;
 using System.Threading;
 using System.Reflection;
@@ -87,3 +90,4 @@ namespace MonoTests.System.Reflection {
 	}
 }
 
+#endif

+ 3 - 0
mcs/class/corlib/Test/System.Reflection/AssemblyInformationalVersionAttributeTest.cs

@@ -4,6 +4,8 @@
 //
 // (C) 2004 Ximian, Inc. http://www.ximian.com
 //
+#if !MOBILE
+
 using System;
 using System.Threading;
 using System.Reflection;
@@ -80,3 +82,4 @@ namespace MonoTests.System.Reflection {
 	}
 }
 
+#endif

+ 2 - 2
mcs/class/corlib/Test/System.Reflection/AssemblyNameTest.cs

@@ -13,7 +13,7 @@ using System;
 using System.Configuration.Assemblies;
 using System.IO;
 using System.Reflection;
-#if !TARGET_JVM
+#if !TARGET_JVM && !MOBILE
 using System.Reflection.Emit;
 #endif
 using System.Runtime.Serialization;
@@ -889,7 +889,7 @@ public class AssemblyNameTest {
 		return assemblyName;
 	}
 
-#if !TARGET_JVM // Reflection.Emit is not supported for TARGET_JVM.
+#if !TARGET_JVM && !MOBILE // Reflection.Emit is not supported for TARGET_JVM.
 	private Assembly GenerateAssembly (AssemblyName name) 
 	{
 		AssemblyBuilder ab = domain.DefineDynamicAssembly (

+ 11 - 4
mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs

@@ -35,7 +35,7 @@ using System.Configuration.Assemblies;
 using System.Globalization;
 using System.IO;
 using System.Reflection;
-#if !TARGET_JVM
+#if !TARGET_JVM && !MONOTOUCH
 using System.Reflection.Emit;
 #endif
 using System.Threading;
@@ -151,7 +151,7 @@ namespace MonoTests.System.Reflection
 			}
 		}
 
-#if !TARGET_JVM // Reflection.Emit is not supported.
+#if !TARGET_JVM && !MONOTOUCH // Reflection.Emit is not supported.
 		[Test]
 		public void GetModules_MissingFile ()
 		{
@@ -205,8 +205,13 @@ namespace MonoTests.System.Reflection
 		public void Corlib_test ()
 		{
 			Assembly corlib_test = Assembly.GetExecutingAssembly ();
+#if MOBILE
+			Assert.IsNotNull (corlib_test.EntryPoint, "EntryPoint");
+			Assert.IsNull (corlib_test.Evidence, "Evidence");
+#else
 			Assert.IsNull (corlib_test.EntryPoint, "EntryPoint");
 			Assert.IsNotNull (corlib_test.Evidence, "Evidence");
+#endif
 			Assert.IsFalse (corlib_test.GlobalAssemblyCache, "GlobalAssemblyCache");
 
 			Assert.IsTrue (corlib_test.GetReferencedAssemblies ().Length > 0, "GetReferencedAssemblies");
@@ -415,7 +420,7 @@ namespace MonoTests.System.Reflection
 		[Test]
 		public void LoadWithPartialName ()
 		{
-			string [] names = { "corlib_test_net_1_1", "corlib_test_net_2_0", "corlib_test_net_4_0", "corlib_test_net_4_5", "corlib_plattest" };
+			string [] names = { "corlib_test_net_1_1", "corlib_test_net_2_0", "corlib_test_net_4_0", "corlib_test_net_4_5", "corlib_plattest", "mscorlibtests" };
 
 			foreach (string s in names)
 				if (Assembly.LoadWithPartialName (s) != null)
@@ -462,7 +467,7 @@ namespace MonoTests.System.Reflection
 			}
 		}
 
-#if !TARGET_JVM // Reflection.Emit is not supported.
+#if !TARGET_JVM && !MONOTOUCH // Reflection.Emit is not supported.
 		[Test]
 		public void Location_Empty() {
 			string assemblyFileName = Path.Combine (
@@ -1096,7 +1101,9 @@ namespace MonoTests.System.Reflection
 			Assert.AreEqual (typeof (Module), module.GetType (), "#2");
 #endif
 
+#if !MONOTOUCH
 			Assert.AreEqual ("mscorlib.dll", module.Name, "#3");
+#endif
 			Assert.IsFalse (module.IsResource (), "#4");
 			Assert.IsTrue (assembly.GetModules ().Length > 0, "#5");
 			Assert.AreSame (module, assembly.GetModules () [0], "#6");

+ 0 - 1
mcs/class/corlib/Test/System.Reflection/CustomAttributeDataTest.cs

@@ -32,7 +32,6 @@
 using NUnit.Framework;
 using System;
 using System.Reflection;
-using System.Reflection.Emit;
 using System.Collections.Generic;
 
 namespace MonoTests.System.Reflection

+ 0 - 3
mcs/class/corlib/Test/System.Reflection/EventInfoTest.cs

@@ -28,9 +28,6 @@
 using System;
 using System.Threading;
 using System.Reflection;
-#if !TARGET_JVM
-using System.Reflection.Emit;
-#endif // TARGET_JVM
 using System.Runtime.InteropServices;
 
 using NUnit.Framework;

+ 1 - 1
mcs/class/corlib/Test/System.Reflection/FieldInfoTest.cs

@@ -31,7 +31,7 @@
 using System;
 using System.Threading;
 using System.Reflection;
-#if !TARGET_JVM
+#if !TARGET_JVM && !MONOTOUCH
 using System.Reflection.Emit;
 #endif // TARGET_JVM
 using System.Runtime.InteropServices;

+ 4 - 2
mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs

@@ -31,7 +31,9 @@ using NUnit.Framework;
 using System;
 using System.Threading;
 using System.Reflection;
+#if !MONOTOUCH
 using System.Reflection.Emit;
+#endif
 using System.Runtime.InteropServices;
 using System.Runtime.CompilerServices;
 
@@ -552,7 +554,7 @@ namespace MonoTests.System.Reflection
 			} catch (InvalidOperationException ex) {
 			}
 		}
-
+#if !MONOTOUCH
 		public TFoo SimpleGenericMethod2<TFoo, TBar> () { return default (TFoo); }
 		/*Test for the uggly broken behavior of SRE.*/
 		[Test]
@@ -571,7 +573,7 @@ namespace MonoTests.System.Reflection
 			/*broken ReturnType*/
 			Assert.AreSame (gmi.GetGenericArguments () [0], ins.ReturnType, "#2");
 		}
-
+#endif
 		public static int? pass_nullable (int? i)
 		{
 			return i;

+ 6 - 3
mcs/class/corlib/Test/System.Reflection/ModuleTest.cs

@@ -10,7 +10,9 @@
 using System;
 using System.Threading;
 using System.Reflection;
+#if !MONOTOUCH
 using System.Reflection.Emit;
+#endif
 using System.Runtime.Serialization;
 using System.IO;
 using System.Collections;
@@ -91,7 +93,7 @@ public class ModuleTest
 	}
 
 	// Some of these tests overlap with the tests for ModuleBuilder
-
+#if !MONOTOUCH
 	[Test]
 	[Category("NotDotNet")] // path length can cause suprious failures
 	public void TestGlobalData () {
@@ -151,6 +153,7 @@ public class ModuleTest
 		Assert.IsNull (m2.GetField ("DATA"), "#B3");
 		Assert.IsNull (m2.GetField ("DATA", BindingFlags.Public), "#B4");
 	}
+#endif
 
 #if NET_2_0
 	[Test]
@@ -327,7 +330,7 @@ public class ModuleTest
 		Module m = typeof (ModuleTest).Module;
 		m.GetObjectData (null, new StreamingContext (StreamingContextStates.All));
 	}
-
+#if !MONOTOUCH
 	[Test]
 	public void GetTypes ()
 	{
@@ -353,7 +356,7 @@ public class ModuleTest
 		Assert.AreEqual (1, types.Count);
 		Assert.AreEqual ("Foo", ((Type)(types [0])).Name);
 	}
-
+#endif
 	class FindTypesTestFirstClass {
 	}
 

+ 4 - 0
mcs/class/corlib/Test/System.Reflection/MonoGenericClassTest.cs

@@ -7,6 +7,8 @@
 // Copyright 2011 Xamarin Inc (http://www.xamarin.com).
 //
 
+#if !MONOTOUCH
+
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -204,3 +206,5 @@ namespace MonoTests.System.Reflection.Emit
 		}
 	}
 }
+
+#endif

+ 0 - 3
mcs/class/corlib/Test/System.Reflection/ParameterInfoTest.cs

@@ -11,9 +11,6 @@
 using System;
 using System.Threading;
 using System.Reflection;
-#if !TARGET_JVM
-using System.Reflection.Emit;
-#endif // TARGET_JVM
 using System.Runtime.InteropServices;
 using System.Runtime.CompilerServices;
 

+ 4 - 2
mcs/class/corlib/Test/System.Reflection/PropertyInfoTest.cs

@@ -31,7 +31,9 @@ using System;
 using System.Reflection;
 using System.Runtime.InteropServices;
 using System.Threading;
+#if !MONOTOUCH
 using System.Reflection.Emit;
+#endif
 using System.IO;
 
 using NUnit.Framework;
@@ -354,7 +356,7 @@ namespace MonoTests.System.Reflection
 				get { return 99; }
 			}
 		}
-
+#if !MONOTOUCH
 		[Test]
 		public void ConstantValue () {
 			/*This test looks scary because we can't generate a default value with C# */
@@ -399,7 +401,7 @@ namespace MonoTests.System.Reflection
 			} catch (InvalidOperationException) {
 			}
 		}
-
+#endif
 #if NET_2_0
 		public class A<T>
 		{

+ 1 - 1
mcs/class/corlib/Test/System.Reflection/TypeDelegatorTest.cs

@@ -28,7 +28,7 @@
 using System;
 using System.Threading;
 using System.Reflection;
-#if !TARGET_JVM
+#if !TARGET_JVM && !MONOTOUCH
 using System.Reflection.Emit;
 #endif // TARGET_JVM
 

+ 5 - 0
mcs/class/corlib/Test/System.Resources/ResourceReaderTest.cs

@@ -99,6 +99,7 @@ namespace MonoTests.System.Resources
 		}
 
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void ConstructorString ()
 		{
 			if (!File.Exists (m_ResourceFile)) {
@@ -125,6 +126,7 @@ namespace MonoTests.System.Resources
 		}
 
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void ConstructorStream_Closed ()
 		{
 			Stream stream = new FileStream (m_ResourceFile, FileMode.Open);
@@ -143,6 +145,7 @@ namespace MonoTests.System.Resources
 		}
 
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void Stream ()
 		{
 			Stream stream = new FileStream (m_ResourceFile, FileMode.Open);
@@ -152,6 +155,7 @@ namespace MonoTests.System.Resources
 		}
 
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void Close ()
 		{
 			Stream stream = new FileStream (m_ResourceFile, FileMode.Open);
@@ -164,6 +168,7 @@ namespace MonoTests.System.Resources
 		}
 
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void Enumerator ()
 		{
 			Stream stream = new FileStream (m_ResourceFile, FileMode.Open);

+ 2 - 2
mcs/class/corlib/Test/System.Resources/ResourceWriterTest.cs

@@ -349,6 +349,7 @@ namespace MonoTests.System.Resources
 		// to test that we support all kind of Stream instances,
 		// and not only MemoryStream, as it used to be before 4.0.
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void AddResource_Stream_Default ()
 		{
 			MemoryStream stream = new MemoryStream ();
@@ -582,8 +583,8 @@ namespace MonoTests.System.Resources
 		}
 #endif
 
-#if NET_2_0
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void Bug81759 ()
 		{
 			MemoryStream ms = new MemoryStream ();
@@ -600,7 +601,6 @@ namespace MonoTests.System.Resources
 				Assert.AreEqual ("Size", de.Value.GetType ().Name, "#2");
 			}
 		}
-#endif
 
 		[Test]
 		public void Close ()

+ 2 - 1
mcs/class/corlib/Test/System.Runtime.InteropServices/GCHandleTest.cs

@@ -125,7 +125,7 @@ namespace MonoTests.System.Runtime.InteropServices
 				gch.Free ();
 			}
 		}
-
+#if !MONOTOUCH
 		[Test]
 		public void WeakHandleWorksOnNonRootDomain ()
 		{
@@ -192,6 +192,7 @@ namespace MonoTests.System.Runtime.InteropServices
 			private readonly string _assemblyFile;
 			private readonly string _assemblyName;
 		}
+#endif
 	}
 
 }

+ 12 - 10
mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs

@@ -12,7 +12,9 @@ using NUnit.Framework;
 using System;
 using System.IO;
 using System.Reflection;
+#if !MOBILE
 using System.Reflection.Emit;
+#endif
 using System.Runtime.InteropServices;
 using System.Security;
 using System.Text;
@@ -188,7 +190,7 @@ namespace MonoTests.System.Runtime.InteropServices
 				Assert.AreEqual ("fieldName", ex.ParamName, "#5");
 			}
 		}
-
+#if !MOBILE
 		[Test]
 		public void GetHINSTANCE ()
 		{
@@ -243,7 +245,7 @@ namespace MonoTests.System.Runtime.InteropServices
 				Assert.AreEqual ("m", ex.ParamName, "#5");
 			}
 		}
-
+#endif
 		[Test] // bug #319009
 		public void StringToHGlobalUni ()
 		{
@@ -277,6 +279,7 @@ namespace MonoTests.System.Runtime.InteropServices
 		}
 
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void BSTR_Roundtrip ()
 		{
 			string s = "mono";
@@ -286,6 +289,7 @@ namespace MonoTests.System.Runtime.InteropServices
 		}
 
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void StringToBSTRWithNullValues ()
 		{
 			int size = 128;
@@ -585,6 +589,7 @@ namespace MonoTests.System.Runtime.InteropServices
 		}
 #endif
 
+#if !NET_2_1
 		[Test]
 		public void TestGetComSlotForMethodInfo ()
 		{
@@ -607,11 +612,7 @@ namespace MonoTests.System.Runtime.InteropServices
 				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
 				Assert.IsNull (ex.InnerException, "#3");
 				Assert.IsNotNull (ex.Message, "#4");
-#if NET_2_0
 				Assert.AreEqual ("m", ex.ParamName, "#5");
-#else
-				Assert.IsNull (ex.ParamName, "#5");
-#endif
 			}
 		}
 
@@ -630,7 +631,7 @@ namespace MonoTests.System.Runtime.InteropServices
 				Assert.AreEqual ("m", ex.ParamName, "#5");
 			}
 		}
-
+#endif
 		[Test]
 		public void TestPtrToStringAuto ()
 		{
@@ -659,7 +660,7 @@ namespace MonoTests.System.Runtime.InteropServices
 				Marshal.FreeHGlobal (ptr);
 			}
 		}
-
+#if !MOBILE
 		[Test]
 		public void TestGenerateProgIdForType()
 		{
@@ -671,7 +672,7 @@ namespace MonoTests.System.Runtime.InteropServices
 			output = Marshal.GenerateProgIdForType(typeof(TestCoClassWithProgId));
 			Assert.AreEqual ("CoClassWithProgId", output, "#2");
 		}
-
+#endif
 		[Test]
 		public void TestGlobalAlloc ()
 		{
@@ -712,7 +713,7 @@ namespace MonoTests.System.Runtime.InteropServices
 			int nSize
 		);
 	}
-
+#if !NET_2_1
 	[ComImport()]
 	[Guid("AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA")]
 	interface ITestDefault
@@ -774,5 +775,6 @@ namespace MonoTests.System.Runtime.InteropServices
 		{
 		}
 	}
+#endif
 }
 #endif

+ 1 - 6
mcs/class/corlib/Test/System.Runtime.InteropServices/RuntimeEnvironmentTest.cs

@@ -56,19 +56,14 @@ namespace MonoTests.System.Runtime.InteropServices {
 		}
 
 		[Test]
-#if NET_2_1
+#if MOBILE
 		[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;
-#if NET_2_0
 			// FIXME: This doesn't work when doing make distcheck (probably because the corlib used isn't the GAC)
 //			Assert.IsTrue (RuntimeEnvironment.FromGlobalAccessCache (corlib), "corlib");
-#else
-			// note: mscorlib.dll wasn't in the GAC for 1.x
-			Assert.IsFalse (RuntimeEnvironment.FromGlobalAccessCache (corlib), "corlib");
-#endif
 			Assembly corlib_test = Assembly.GetExecutingAssembly ();
 			Assert.IsFalse (RuntimeEnvironment.FromGlobalAccessCache (corlib_test), "corlib_test");
 		}

+ 1 - 0
mcs/class/corlib/Test/System.Runtime.Remoting/SynchronizationAttributeTest.cs

@@ -337,6 +337,7 @@ namespace MonoTests.System.Runtime.Remoting
 		
 		[Test]
 		[Category("NotDotNet")]
+		[Category ("MobileNotWorking")]
 		public void TestMonitorWait ()
 		{
 			Thread tr = new Thread (new ThreadStart (DoMonitorPulse));

+ 0 - 16
mcs/class/corlib/Test/System.Runtime.Serialization/ObjectManagerTest.cs

@@ -129,20 +129,4 @@ namespace MonoTests.System.Runtime.Serialization
 			return sb.ToString ();
 		}
 	}
-
-	class X
-	{
-		static void Main ()
-		{
-			using (MemoryStream ms = new MemoryStream ()) {
-				Bar bar = new Bar (8, 3, 5, 21);
-				bar.Save (ms);
-
-				ms.Position = 0;
-
-				bar = Bar.Load (ms);
-				Console.WriteLine (bar);
-			}
-		}
-	}
 }

+ 3 - 2
mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest.cs

@@ -28,6 +28,7 @@ namespace MonoTests.System.Runtime.Serialization
 		string uri;
 
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void TestSerialization ()
 		{
 			MethodTester mt = new MethodTester();
@@ -765,14 +766,14 @@ namespace MonoTests.System.Runtime.Serialization
 		void SerializeCall (IMessage call)
 		{
 			RemotingSurrogateSelector rss = new RemotingSurrogateSelector();
-			IRemotingFormatter fmt = new BinaryFormatter (rss, new StreamingContext(StreamingContextStates.Remoting));
+			var fmt = new BinaryFormatter (rss, new StreamingContext(StreamingContextStates.Remoting));
 			fmt.Serialize (_stream, call, GetHeaders());
 		}
 
 		void SerializeResponse (IMessage resp)
 		{
 			RemotingSurrogateSelector rss = new RemotingSurrogateSelector();
-			IRemotingFormatter fmt = new BinaryFormatter (rss, new StreamingContext(StreamingContextStates.Remoting));
+			var fmt = new BinaryFormatter (rss, new StreamingContext(StreamingContextStates.Remoting));
 			fmt.Serialize (_stream, resp, GetHeaders());
 		}
 

+ 4 - 0
mcs/class/corlib/Test/System.Security.AccessControl/MutexSecurityTest.cs

@@ -5,6 +5,8 @@
 //
 // Copyright (C) 2012 James Bellinger
 
+#if !MOBILE
+
 using System;
 using System.Collections.Generic;
 using System.Security.AccessControl;
@@ -139,3 +141,5 @@ namespace MonoTests.System.Security.AccessControl
 	}
 }
 
+#endif
+

+ 2 - 1
mcs/class/corlib/Test/System.Security.AccessControl/RawSecurityDescriptorTest.cs

@@ -9,6 +9,7 @@ using System;
 using System.Security.AccessControl;
 using System.Security.Principal;
 using NUnit.Framework;
+using NUnit.Framework.SyntaxHelpers;
 
 namespace MonoTests.System.Security.AccessControl {
 
@@ -18,7 +19,7 @@ namespace MonoTests.System.Security.AccessControl {
 		{
 			RawSecurityDescriptor sd = new RawSecurityDescriptor (sddl);
 			
-			Assert.GreaterOrEqual (sd.BinaryLength, 0);
+			Assert.That (sd.BinaryLength, Is.GreaterThanOrEqualTo (0));
 			byte[] buffer = new byte[sd.BinaryLength];
 			
 			sd.GetBinaryForm (buffer, 0);

+ 4 - 0
mcs/class/corlib/Test/System.Security.AccessControl/RegistrySecurityTest.cs

@@ -3,6 +3,8 @@
 // Authors:
 //	James Bellinger ([email protected])
 
+#if !MOBILE
+
 using System;
 using System.IO;
 using System.Security.AccessControl;
@@ -99,3 +101,5 @@ namespace MonoTests.System.Security.AccessControl
 	}
 }
 
+#endif
+

+ 4 - 0
mcs/class/corlib/Test/System.Security.Cryptography/AesCfbTest.cs

@@ -47,7 +47,11 @@ namespace MonoTests.System.Security.Cryptography {
 		{
 			// that will return a AesCryptoServiceProvider
 			var aes = GetInstance ();
+#if MOBILE
+			Assert.AreEqual ("System.Security.Cryptography.AesManaged", aes.ToString (), "Default");
+#else
 			Assert.AreEqual ("System.Security.Cryptography.AesCryptoServiceProvider", aes.ToString (), "Default");
+#endif
 			Assert.AreEqual (8, aes.FeedbackSize, "FeedbackSize");
 			ProcessBlockSizes (aes);
 		}

+ 2 - 3
mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs

@@ -104,7 +104,7 @@ public class CryptoConfigTest {
 		CreateFromName ("System.Security.Cryptography.HMACSHA1", "System.Security.Cryptography.HMACSHA1");
 		CreateFromName ("MACTripleDES", "System.Security.Cryptography.MACTripleDES");
 		CreateFromName ("System.Security.Cryptography.MACTripleDES", "System.Security.Cryptography.MACTripleDES");
-#if NET_2_0
+
 		// new HMAC - new base class doesn't return anything with it's short name
 		Assert.IsNull (CryptoConfig.CreateFromName ("HMAC"), "HMAC");
 		CreateFromName ("System.Security.Cryptography.HMAC", "System.Security.Cryptography.HMACSHA1");
@@ -123,9 +123,8 @@ public class CryptoConfigTest {
 		CreateFromName ("RIPEMD-160", "System.Security.Cryptography.RIPEMD160Managed");
 		CreateFromName ("System.Security.Cryptography.RIPEMD160", "System.Security.Cryptography.RIPEMD160Managed");
 		// x.509 stuff
-#if !TARGET_JVM //TargetJvmNotWorking - this algorithm should be added to System
+#if !TARGET_JVM && !MOBILE //TargetJvmNotWorking - this algorithm should be added to System
 		CreateFromName ("X509Chain", "System.Security.Cryptography.X509Certificates.X509Chain");
-#endif
 #endif
 		// note: CryptoConfig can create any object !
 		CreateFromName ("System.Security.Cryptography.CryptoConfig", "System.Security.Cryptography.CryptoConfig");

+ 3 - 0
mcs/class/corlib/Test/System.Security.Permissions/EnvironmentPermissionAttributeTest.cs

@@ -36,6 +36,9 @@ using System.Security.Permissions;
 namespace MonoTests.System.Security.Permissions {
 
 	[TestFixture]
+#if MOBILE
+	[Ignore]
+#endif
 	public class EnvironmentPermissionAttributeTest {
 
 		private static string envar = "TMP";

+ 3 - 0
mcs/class/corlib/Test/System.Security.Permissions/EnvironmentPermissionTest.cs

@@ -35,6 +35,9 @@ using System.Security.Permissions;
 namespace MonoTests.System.Security.Permissions {
 
 	[TestFixture]
+#if MOBILE
+	[Ignore]
+#endif
 	public class EnvironmentPermissionTest {
 
 		private static string className = "System.Security.Permissions.EnvironmentPermission, ";

+ 3 - 0
mcs/class/corlib/Test/System.Security.Permissions/FileDialogPermissionAttributeTest.cs

@@ -36,6 +36,9 @@ using System.Security.Permissions;
 namespace MonoTests.System.Security.Permissions {
 
 	[TestFixture]
+#if MOBILE
+	[Ignore]
+#endif
 	public class FileDialogPermissionAttributeTest {
 
 		[Test]

+ 3 - 0
mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionAttributeTest.cs

@@ -39,6 +39,9 @@ using System.Text;
 namespace MonoTests.System.Security.Permissions {
 
 	[TestFixture]
+#if MOBILE
+	[Ignore]
+#endif
 	public class FileIOPermissionAttributeTest {
 
 		[Test]

+ 9 - 0
mcs/class/corlib/Test/System.Security.Permissions/HostProtectionAttributeTest.cs

@@ -36,6 +36,9 @@ using System.Security.Permissions;
 namespace MonoTests.System.Security.Permissions {
 
 	[TestFixture]
+#if MOBILE
+	[Ignore]
+#endif
 	public class HostProtectionAttributeTest {
 
 		private void DefaultTests (HostProtectionAttribute hpa)
@@ -58,6 +61,9 @@ namespace MonoTests.System.Security.Permissions {
 		}
 
 		[Test]
+#if MOBILE
+		[Ignore]
+#endif
 		public void HostProtectionAttribute_Empty ()
 		{
 			// note: normally security attributes don't have an empty constructor
@@ -87,6 +93,9 @@ namespace MonoTests.System.Security.Permissions {
 		}
 
 		[Test]
+#if MOBILE
+		[Ignore]
+#endif
 		[ExpectedException (typeof (ArgumentException))]
 		public void HostProtectionAttribute_InheritanceDemand ()
 		{

+ 5 - 2
mcs/class/corlib/Test/System.Security.Permissions/IBuiltInPermissionTest.cs

@@ -110,8 +110,11 @@ namespace MonoTests.System.Security.Permissions {
 			IPermission p = (IPermission) new PrincipalPermission (PermissionState.None);
 			Assert.AreEqual (8, GetTokenIndex (p));
 		}
-#if NET_2_0
+
 		[Test]
+#if MOBILE
+		[Ignore]
+#endif
 		public void HostProtection ()
 		{
 			HostProtectionAttribute hpa = new HostProtectionAttribute ();
@@ -119,7 +122,7 @@ namespace MonoTests.System.Security.Permissions {
 			IPermission p = hpa.CreatePermission ();
 			Assert.AreEqual (9, GetTokenIndex (p));
 		}
-#endif
+
 		[Test]
 		public void PublisherIdentity ()
 		{

+ 3 - 0
mcs/class/corlib/Test/System.Security.Permissions/PermissionSetAttributeTest.cs

@@ -35,6 +35,9 @@ using System.Security.Permissions;
 namespace MonoTests.System.Security.Permissions {
 
 	[TestFixture]
+#if MOBILE
+	[Ignore]
+#endif
 	public class PermissionSetAttributeTest {
 
 		[Test]

+ 3 - 0
mcs/class/corlib/Test/System.Security.Permissions/ReflectionPermissionAttributeTest.cs

@@ -36,6 +36,9 @@ using System.Security.Permissions;
 namespace MonoTests.System.Security.Permissions {
 
 	[TestFixture]
+#if MOBILE
+	[Ignore]
+#endif
 	public class ReflectionPermissionAttributeTest {
 
 		[Test]

+ 3 - 0
mcs/class/corlib/Test/System.Security.Permissions/SecurityPermissionAttributeTest.cs

@@ -36,6 +36,9 @@ using System.Security.Permissions;
 namespace MonoTests.System.Security.Permissions {
 
 	[TestFixture]
+#if MOBILE
+	[Ignore]
+#endif
 	public class SecurityPermissionAttributeTest {
 
 		[Test]

+ 3 - 0
mcs/class/corlib/Test/System.Security.Permissions/StrongNameIdentityPermissionAttributeTest.cs

@@ -36,6 +36,9 @@ using System.Security.Permissions;
 namespace MonoTests.System.Security.Permissions {
 
 	[TestFixture]
+#if MOBILE
+	[Ignore]
+#endif
 	public class StrongNameIdentityPermissionAttributeTest {
 
 		static string pk = "00240000048000009400000006020000002400005253413100040000010001003DBD7208C62B0EA8C1C058072B635F7C9ABDCB22DB20B2A9DADAEFE800642F5D8DEB7802F7A5367728D7558D1468DBEB2409D02B131B926E2E59544AAC18CFC909023F4FA83E94001FC2F11A27477D1084F514B861621A0C66ABD24C4B9FC90F3CD8920FF5FFCED76E5C6FB1F57DD356F96727A4A5485B079344004AF8FFA4CB";

+ 6 - 0
mcs/class/corlib/Test/System.Security.Policy/AllMembershipConditionTest.cs

@@ -163,6 +163,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[Ignore]
+#endif
 		[ExpectedException (typeof (ArgumentNullException))]
 		public void FromXml_SecurityElementNull ()
 		{
@@ -194,6 +197,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[Ignore]
+#endif
 		public void ToXml ()
 		{
 			AllMembershipCondition all = new AllMembershipCondition ();

+ 6 - 0
mcs/class/corlib/Test/System.Security.Policy/ApplicationDirectoryMembershipConditionTest.cs

@@ -179,6 +179,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[Ignore]
+#endif
 		[ExpectedException (typeof (ArgumentNullException))]
 		public void FromXml_SecurityElementNull ()
 		{
@@ -210,6 +213,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[Ignore]
+#endif
 		public void ToXml ()
 		{
 			ApplicationDirectoryMembershipCondition ad = new ApplicationDirectoryMembershipCondition ();

+ 1 - 0
mcs/class/corlib/Test/System.Security.Policy/EvidenceTest.cs

@@ -354,6 +354,7 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void Assembly_NoPermissionRequestEvidence ()
 		{
 			// PermissionRequestEvidence is only used druing policy resolution

+ 6 - 0
mcs/class/corlib/Test/System.Security.Policy/GacMembershipConditionTest.cs

@@ -152,6 +152,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[Ignore]
+#endif
 		[ExpectedException (typeof (ArgumentNullException))]
 		public void FromXml_SecurityElementNull ()
 		{
@@ -182,6 +185,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[Ignore]
+#endif
 		public void ToXml ()
 		{
 			GacMembershipCondition gac = new GacMembershipCondition ();

+ 6 - 0
mcs/class/corlib/Test/System.Security.Policy/HashMembershipConditionTest.cs

@@ -270,6 +270,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[Ignore]
+#endif
 		[ExpectedException (typeof (ArgumentNullException))]
 		public void FromXml_SecurityElementNull ()
 		{
@@ -304,6 +307,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[Ignore]
+#endif
 		public void ToXml ()
 		{
 			HashMembershipCondition hash = new HashMembershipCondition (md5, digestMd5);

+ 3 - 0
mcs/class/corlib/Test/System.Security.Policy/PolicyLevelTest.cs

@@ -38,6 +38,9 @@ using System.Text;
 namespace MonoTests.System.Security.Policy {
 
 	[TestFixture]
+#if MOBILE
+	[Ignore ("Not supported")]
+#endif
 	public class PolicyLevelTest {
 
 		static string minimal = null;

+ 3 - 0
mcs/class/corlib/Test/System.Security.Policy/PolicyStatementTest.cs

@@ -152,6 +152,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[Ignore]
+#endif
 		[ExpectedException (typeof (ArgumentNullException))]
 		public void FromXml_SecurityElementNull ()
 		{

+ 9 - 4
mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs

@@ -73,11 +73,7 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
-#if NET_2_0
 		[ExpectedException (typeof (ArgumentException))]
-#else
-		[ExpectedException (typeof (NullReferenceException))]
-#endif
 		public void InvalidConstructor () 
 		{
 			byte[] n = null;
@@ -221,6 +217,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[Ignore]
+#endif
 		[ExpectedException (typeof (ArgumentNullException))]
 		public void FromXml_SecurityElementNull ()
 		{
@@ -229,6 +228,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[ExpectedException (typeof (NotSupportedException))]
+#endif
 		public void FromXml_PolicyLevel ()
 		{
 			PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509);
@@ -271,6 +273,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[ExpectedException (typeof (NotSupportedException))]
+#endif
 		public void ToXmlPolicyLevel () 
 		{
 			PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509);

+ 6 - 0
mcs/class/corlib/Test/System.Security.Policy/SiteMembershipConditionTest.cs

@@ -205,6 +205,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[ExpectedException (typeof (NotSupportedException))]
+#endif
 		public void FromXml_PolicyLevel () 
 		{
 			SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
@@ -230,6 +233,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[ExpectedException (typeof (NotSupportedException))]
+#endif
 		public void ToXml_PolicyLevel () 
 		{
 			SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");

+ 3 - 0
mcs/class/corlib/Test/System.Security.Policy/StrongNameMembershipConditionTest.cs

@@ -38,6 +38,9 @@ using System.Security.Policy;
 namespace MonoTests.System.Security.Policy {
 
 	[TestFixture]
+#if MOBILE
+	[Ignore]
+#endif
 	public class StrongNameMembershipConditionTest {
 
 		static Evidence allEmpty;

+ 6 - 0
mcs/class/corlib/Test/System.Security.Policy/UrlMembershipConditionTest.cs

@@ -342,6 +342,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[ExpectedException (typeof (NotSupportedException))]
+#endif
 		public void FromXml_PolicyLevel () 
 		{
 			UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
@@ -367,6 +370,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[ExpectedException (typeof (NotSupportedException))]
+#endif
 		public void ToXml_PolicyLevel () 
 		{
 			UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");

+ 6 - 0
mcs/class/corlib/Test/System.Security.Policy/ZoneMembershipConditionTest.cs

@@ -305,6 +305,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[ExpectedException (typeof (NotSupportedException))]
+#endif
 		public void FromXml_PolicyLevel ()
 		{
 			ZoneMembershipCondition zmc = new ZoneMembershipCondition (SecurityZone.MyComputer);
@@ -330,6 +333,9 @@ namespace MonoTests.System.Security.Policy {
 		}
 
 		[Test]
+#if MOBILE
+		[ExpectedException (typeof (NotSupportedException))]
+#endif
 		public void ToXml_PolicyLevel ()
 		{
 			ZoneMembershipCondition zmc = new ZoneMembershipCondition (SecurityZone.MyComputer);

+ 1 - 1
mcs/class/corlib/Test/System.Security.Principal/NTAccountTest.cs

@@ -13,7 +13,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Security.Principal
 {
     [TestFixture]
-    public class NTAccountTest : Assert
+    public class NTAccountTest
     {
         [Test]
         public void ConstructorOneString()

+ 1 - 1
mcs/class/corlib/Test/System.Security.Principal/SecurityIdentifierTest.cs

@@ -13,7 +13,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Security.Principal
 {
 	[TestFixture]
-	public class SecurityIdentifierTest : Assert
+	public class SecurityIdentifierTest
 	{
 		[Test, ExpectedException (typeof (ArgumentNullException))]
 		public void ConstructorNull ()

+ 2 - 1
mcs/class/corlib/Test/System.Security/PermissionSetTest.cs

@@ -1172,7 +1172,7 @@ namespace MonoTests.System.Security {
 			ps.PermitOnly ();
 			// it's simply ignored
 		}
-
+#if !MOBILE
 		// note: this only ensure that the ECMA key support unification (more test required, outside corlib, for other keys, like MS final).
 		private const string PermissionPattern = "<PermissionSet class=\"System.Security.PermissionSet\" version=\"1\"><IPermission class=\"System.Security.Permissions.FileDialogPermission, mscorlib, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089\" version=\"1\" Access=\"Open\"/></PermissionSet>";
 		private const string fx10version = "1.0.3300.0";
@@ -1211,5 +1211,6 @@ namespace MonoTests.System.Security {
 		{
 			Unification (String.Format (PermissionPattern, "9.99.999.9999"));
 		}
+#endif
 	}
 }

+ 3 - 3
mcs/class/corlib/Test/System.Security/SecurityCriticalAttributeTest.cs

@@ -35,7 +35,7 @@ namespace MonoTests.System.Security {
 
 	[TestFixture]
 	public class SecurityCriticalAttributeTest {
-
+#if !MOBILE
 		[Test]
 		public void Constructor_Default ()
 		{
@@ -64,7 +64,7 @@ namespace MonoTests.System.Security {
 			SecurityCriticalAttribute sca = new SecurityCriticalAttribute (scs);
 			Assert.AreEqual (SecurityCriticalScope.Explicit, sca.Scope);
 		}
-
+#endif
 		[Test]
 		public void Attributes ()
 		{
@@ -76,7 +76,7 @@ namespace MonoTests.System.Security {
 			AttributeUsageAttribute aua = (AttributeUsageAttribute)attrs [0];
 			Assert.IsFalse (aua.AllowMultiple, "AllowMultiple");
 			Assert.IsFalse (aua.Inherited, "Inherited");
-#if NET_4_0
+#if NET_4_0 && !MOBILE
 			AttributeTargets at = (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Delegate);
 #else
 			AttributeTargets at = (AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate);

+ 2 - 2
mcs/class/corlib/Test/System.Security/SecurityExceptionTest.cs

@@ -76,14 +76,14 @@ namespace MonoTests.System.Security {
 		public void Constructor_MessageTypeState () 
 		{
 			SecurityException se = new SecurityException ("message", typeof (EnvironmentPermission), "mono");
-#if ! NET_1_0
 			Assert.IsNull (se.GrantedSet, "GrantedSet");
 			Assert.IsNull (se.RefusedSet, "RefusedSet");
-#endif
 			Assert.AreEqual ("mono", se.PermissionState, "PermissionState");
 			Assert.AreEqual (typeof (EnvironmentPermission), se.PermissionType, "PermissionType");
 
+#if !MOBILE
 			Assert.IsTrue ((se.ToString ().IndexOf ("mono") > 0), "ToString().Include(mono)");
+#endif
 			// note: can't check for PermissionType as it's not shown with MS class lib
 		}
 	}

+ 13 - 20
mcs/class/corlib/Test/System.Security/SecurityManagerTest.cs

@@ -62,26 +62,38 @@ namespace MonoTests.System.Security {
 		}
 
 		[Test]
+#if MOBILE
+		[ExpectedException (typeof (NotSupportedException))]
+#else
 		[ExpectedException (typeof (ArgumentNullException))]
+#endif
 		public void LoadPolicyLevelFromFile_Null ()
 		{
 			SecurityManager.LoadPolicyLevelFromFile (null, PolicyLevelType.AppDomain);
 		}
 
 		[Test]
+#if MOBILE
+		[ExpectedException (typeof (NotSupportedException))]
+#else
 		[ExpectedException (typeof (ArgumentNullException))]
+#endif
 		public void LoadPolicyLevelFromString_Null ()
 		{
 			SecurityManager.LoadPolicyLevelFromString (null, PolicyLevelType.AppDomain);
 		}
 
 		[Test]
+#if MOBILE
+		[ExpectedException (typeof (NotSupportedException))]
+#endif
 		public void PolicyHierarchy () 
 		{
 			IEnumerator e = SecurityManager.PolicyHierarchy ();
 			Assert.IsNotNull (e, "PolicyHierarchy");
 		}
 
+#if !MOBILE
 		private void ResolveEvidenceHost (SecurityZone zone, bool unrestricted, bool empty)
 		{
 			string prefix = zone.ToString () + "-";
@@ -90,26 +102,16 @@ namespace MonoTests.System.Security {
 			PermissionSet ps = SecurityManager.ResolvePolicy (e);
 			// as 2.0 use Unrestricted for Identity permissions they have no need to be 
 			// kept in resolved permission set
-#if NET_2_0
 			Assert.IsTrue ((unrestricted || (ps.Count > 0)), prefix + "Count");
-#else
-			Assert.IsTrue ((ps.Count > 0), prefix + "Count");
-#endif
 			Assert.AreEqual (empty, ps.IsEmpty (), prefix + "IsEmpty");
 			Assert.AreEqual (unrestricted, ps.IsUnrestricted (), prefix + "IsUnrestricted");
-#if NET_2_0
 			if (unrestricted)
 				Assert.IsNull (ps.GetPermission (typeof (ZoneIdentityPermission)), prefix + "GetPermission(ZoneIdentityPermission)");
 			else
 				Assert.IsNotNull (ps.GetPermission (typeof (ZoneIdentityPermission)), prefix + "GetPermission(ZoneIdentityPermission)");
-#else
-			Assert.IsNotNull (ps.GetPermission (typeof (ZoneIdentityPermission)), prefix + "GetPermission(ZoneIdentityPermission)");
-#endif
 		}
 
-#if NET_2_0
 		[Category ("NotWorking")]
-#endif
 		[Test]
 		public void ResolvePolicy_Evidence_Host_Zone () 
 		{
@@ -161,7 +163,6 @@ namespace MonoTests.System.Security {
 			Assert.IsTrue (granted.IsUnrestricted (), "IsUnrestricted");
 		}
 
-#if NET_2_0
 		[Test]
 		public void ResolvePolicy_Evidences_Null ()
 		{
@@ -171,7 +172,6 @@ namespace MonoTests.System.Security {
 			Assert.IsNotNull (ps);
 			Assert.IsFalse (ps.IsUnrestricted (), "IsUnrestricted");
 		}
-#endif
 
 		[Test]
 		public void ResolvePolicy_Evidence_AllNull_NoExecution ()
@@ -194,20 +194,13 @@ namespace MonoTests.System.Security {
 		}
 
 		[Test]
-#if NET_2_0
 		[ExpectedException (typeof (PolicyException))]
 		[Category ("NotWorking")]
-#endif
 		public void ResolvePolicy_Evidence_DenyUnrestricted_CurrentAssembly ()
 		{
 			PermissionSet deny = new PermissionSet (PermissionState.Unrestricted);
 			PermissionSet denied = null;
 			PermissionSet granted = SecurityManager.ResolvePolicy (CurrentEvidence, null, null, deny, out denied);
-			// doing this we denied the Execution right
-#if !NET_2_0
-			Assert.AreEqual (0, denied.Count, "Denied");
-			Assert.IsTrue (granted.IsUnrestricted (), "Granted.IsUnrestricted");
-#endif
 		}
 
 		[Test]
@@ -241,7 +234,7 @@ namespace MonoTests.System.Security {
 			PolicyLevel adl = PolicyLevel.CreateAppDomainLevel ();
 			SecurityManager.SavePolicyLevel (adl);
 		}
-#if NET_2_0
+
 		[Test]
 		public void GetZoneAndOrigin ()
 		{

+ 3 - 0
mcs/class/corlib/Test/System.Text/ASCIIEncodingTest.cs

@@ -9,7 +9,10 @@ using System.Text;
 
 using NUnit.Framework;
 using NUnit.Framework.Constraints;
+
+#if !MOBILE
 using NUnit.Framework.SyntaxHelpers;
+#endif
 
 namespace MonoTests.System.Text
 {

+ 1 - 0
mcs/class/corlib/Test/System.Text/UTF8EncodingTest.cs

@@ -1154,6 +1154,7 @@ namespace MonoTests.System.Text
 		}
 
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void Bug415628 ()
 		{
 			using (var f = File.Open ("Test/resources/415628.bin", FileMode.Open)) {

+ 4 - 1
mcs/class/corlib/Test/System.Threading.Tasks/TaskCompletionSourceTests.cs

@@ -31,6 +31,9 @@ using System.Threading;
 using System.Threading.Tasks;
 
 using NUnit.Framework;
+#if !MOBILE
+using NUnit.Framework.SyntaxHelpers;
+#endif
 
 namespace MonoTests.System.Threading.Tasks
 {
@@ -111,7 +114,7 @@ namespace MonoTests.System.Threading.Tasks
 			Assert.IsNotNull (completionSource.Task, "#1");
 			Assert.IsTrue (completionSource.TrySetException (e), "#2");
 			Assert.AreEqual (TaskStatus.Faulted, completionSource.Task.Status, "#3");
-			Assert.IsInstanceOfType (typeof (AggregateException), completionSource.Task.Exception, "#4.1");
+			Assert.That (completionSource.Task.Exception, Is.TypeOf(typeof (AggregateException)), "#4.1");
 			
 			AggregateException aggr = (AggregateException)completionSource.Task.Exception;
 			Assert.AreEqual (1, aggr.InnerExceptions.Count, "#4.2");

+ 4 - 1
mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs

@@ -36,6 +36,9 @@ using System.Threading.Tasks;
 using System.Collections.Generic;
 
 using NUnit.Framework;
+#if !MOBILE
+using NUnit.Framework.SyntaxHelpers;
+#endif
 
 namespace MonoTests.System.Threading.Tasks
 {
@@ -376,7 +379,7 @@ namespace MonoTests.System.Threading.Tasks
 			Assert.IsNotNull (task.Exception);
 			var agg = task.Exception;
 			Assert.AreEqual (1, agg.InnerExceptions.Count);
-			Assert.IsInstanceOfType (typeof (ApplicationException), agg.InnerExceptions[0]);
+			Assert.That (agg.InnerExceptions[0], Is.TypeOf (typeof (ApplicationException)));
 			Assert.AreEqual (TaskStatus.Faulted, task.Status);
 
 			try {

+ 4 - 1
mcs/class/corlib/Test/System.Threading.Tasks/TaskSchedulerTest.cs

@@ -30,6 +30,9 @@ using System.Threading.Tasks;
 using System.Collections.Generic;
 
 using NUnit.Framework;
+#if !MOBILE
+using NUnit.Framework.SyntaxHelpers;
+#endif
 
 namespace MonoTests.System.Threading.Tasks
 {
@@ -132,7 +135,7 @@ namespace MonoTests.System.Threading.Tasks
 
 			Assert.IsNotNull (ex);
 			Assert.IsNotNull (ex.InnerException);
-			Assert.IsInstanceOfType (typeof (InvalidOperationException), ex.InnerException);
+			Assert.That (ex.InnerException, Is.TypeOf (typeof (InvalidOperationException)));
 		}
 
 		[Test]

+ 1 - 0
mcs/class/corlib/Test/System.Threading/ExecutionContextTest.cs

@@ -70,6 +70,7 @@ namespace MonoTests.System.Threading {
 		}
 
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void CaptureCallContext ()
 		{
 			var value = new CallContextValue (true);

+ 6 - 4
mcs/class/corlib/Test/System.Threading/ThreadLocalTests.cs

@@ -30,6 +30,9 @@ using System.Threading;
 
 using NUnit;
 using NUnit.Framework;
+#if !MOBILE
+using NUnit.Framework.SyntaxHelpers;
+#endif
 
 namespace MonoTests.System.Threading
 {
@@ -69,7 +72,6 @@ namespace MonoTests.System.Threading
 			threadLocal = new ThreadLocal<int> (() => {
 					Interlocked.Increment (ref callTime);
 					throw new ApplicationException ("foo");
-					return 43;
 				});
 
 			Exception exception = null;
@@ -81,7 +83,7 @@ namespace MonoTests.System.Threading
 			}
 
 			Assert.IsNotNull (exception, "#1");
-			Assert.IsInstanceOfType (typeof (ApplicationException), exception, "#2");
+			Assert.That (exception, Is.TypeOf (typeof (ApplicationException)), "#2");
 			Assert.AreEqual (1, callTime, "#3");
 
 			exception = null;
@@ -93,7 +95,7 @@ namespace MonoTests.System.Threading
 			}
 
 			Assert.IsNotNull (exception, "#4");
-			Assert.IsInstanceOfType (typeof (ApplicationException), exception, "#5");
+			Assert.That (exception, Is.TypeOf (typeof (ApplicationException)), "#5");
 			Assert.AreEqual (1, callTime, "#6");
 		}
 
@@ -161,7 +163,7 @@ namespace MonoTests.System.Threading
 			t.Join ();
 			Assert.AreEqual (false, thread_value_created, "#4");
 			Assert.IsNotNull (exception, "#5");
-			Assert.IsInstanceOfType (typeof (ApplicationException), exception, "#6");
+			Assert.That (exception, Is.TypeOf (typeof (ApplicationException)), "#6");
 		}
 
 		void AssertThreadLocal ()

+ 14 - 4
mcs/class/corlib/Test/System/ActivatorTest.cs

@@ -13,7 +13,7 @@ using System;
 using System.Globalization;
 using System.IO;
 using System.Reflection;
-#if !TARGET_JVM // Reflection.Emit not supported for TARGET_JVM
+#if !TARGET_JVM && !MONOTOUCH // Reflection.Emit not supported for TARGET_JVM
 using System.Reflection.Emit;
 #endif
 using System.Runtime.InteropServices;
@@ -118,7 +118,7 @@ namespace MonoTests.System {
 			Assert.AreEqual (7, objCOMTest.Id, "#A05");
 		}
 
-#if !TARGET_JVM // Reflection.Emit not supported for TARGET_JVM
+#if !TARGET_JVM && !MONOTOUCH // Reflection.Emit not supported for TARGET_JVM
 		[Test]
 		[ExpectedException (typeof (MissingMethodException))]
 		public void CreateInstance_TypeBuilder ()
@@ -223,6 +223,7 @@ namespace MonoTests.System {
 			Activator.GetObject (null, "tcp://localhost:1234/COMTestUri");
 		}
 
+#if !MOBILE
 		[Test]
 		[ExpectedException (typeof (ArgumentNullException))]
 		[Category ("TargetJvmNotWorking")]
@@ -230,6 +231,7 @@ namespace MonoTests.System {
 		{
 			Activator.GetObject (typeof (COMTest), null);
 		}
+#endif
 
 /* This test is now executed in System.Runtime.Remoting unit tests 
 		[Test]
@@ -262,6 +264,8 @@ namespace MonoTests.System {
 			// TODO: Implement the test methods for all the overriden function using activationAttribute
 		}
 
+#if !MOBILE
+
 		// note: this only ensure that the ECMA key support unification (more test required, outside corlib, for other keys, like MS final).
 		private const string CorlibPermissionPattern = "System.Security.Permissions.FileDialogPermission, mscorlib, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089";
 		private const string SystemPermissionPattern = "System.Net.DnsPermission, System, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089";
@@ -317,7 +321,7 @@ namespace MonoTests.System {
 		{
 			Assert.IsNull (Type.GetType (String.Format (SystemPermissionPattern, "9.99.999.9999")));
 		}
-
+#endif
 		class foo2<T, U> {}
 		class foo1<T> : foo2<T, int> {}
 
@@ -345,12 +349,18 @@ namespace MonoTests.System {
 			Activator.CreateInstance (AppDomain.CurrentDomain, "mscorlib.dll", "System.Object", false,
 						  BindingFlags.Public | BindingFlags.Instance, null, null, CultureInfo.InvariantCulture,
 						  null, null);
+		}
+
+#if !MONOTOUCH
+		[Test]
+		public void CreateInstanceCustomDomain ()
+		{
 			// FIXME: below works as a standalone case, but does not as a unit test (causes JIT error).
                 	Activator.CreateInstance (AppDomain.CreateDomain ("foo"), "mscorlib.dll", "System.Object", false,
 						  BindingFlags.Public | BindingFlags.Instance, null, null, null,
 						  null, null);
 		}
-
+#endif
 		[Test]
 		public void CreateInstanceCrossDomainNonSerializableArgs ()
 		{

+ 7 - 2
mcs/class/corlib/Test/System/AppDomainSetupTest.cs

@@ -177,8 +177,10 @@ namespace MonoTests.System
 			}
 		}
 
-#if NET_2_0
 		[Test]
+#if MOBILE
+		[Category ("NotWorking")]
+#endif
 		public void AppDomainInitializer1 ()
 		{
 			AppDomainSetup s = new AppDomainSetup ();
@@ -206,13 +208,16 @@ namespace MonoTests.System
 		}
 
 		[Test]
+#if MOBILE
+		[Category ("NotWorking")]
+#else
 		[ExpectedException (typeof (ArgumentException))]
+#endif
 		public void AppDomainInitializerNonStaticMethod ()
 		{
 			AppDomainSetup s = new AppDomainSetup ();
 			s.AppDomainInitializer = InstanceInitializer;
 			AppDomain.CreateDomain ("MyDomain", null, s);
 		}
-#endif
 	}
 }

+ 4 - 0
mcs/class/corlib/Test/System/AppDomainTest.cs

@@ -27,6 +27,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !MOBILE
+
 using NUnit.Framework;
 using System;
 using System.Collections;
@@ -3553,3 +3555,5 @@ namespace MonoTests.System
 		static byte [] pk_token = { 0xce, 0x52, 0x76, 0xd8, 0x68, 0x7e, 0Xc6, 0xdc };
 	}
 }
+
+#endif

+ 4 - 2
mcs/class/corlib/Test/System/AttributeTest.cs

@@ -12,7 +12,9 @@
 
 using System;
 using System.Reflection;
+#if !MONOTOUCH
 using System.Reflection.Emit;
+#endif
 using System.Runtime.InteropServices;
 using System.Threading;
 
@@ -811,7 +813,7 @@ namespace MonoTests.System
 			Assert.IsTrue (type.lastInherit, "#7");
 			Assert.AreEqual (typeof (TestFixtureAttribute), type.lastAttrType, "#8");
 		}
-
+#if !MONOTOUCH
 		[Test]
 		public void GetCustomAttributeOnNewSreTypes ()
 		{
@@ -859,7 +861,7 @@ namespace MonoTests.System
 				Assert.Fail ("#1");
 			} catch (NotSupportedException) {}
 		}
-
+#endif
 		[Test] //Regression test for #499569
 		public void GetCattrOnPropertyAndInheritance ()
 		{

+ 2 - 1
mcs/class/corlib/Test/System/CharCategoryTest.cs

@@ -1709,6 +1709,7 @@ namespace MonoTests.System
 
 	public class CharCategoryUtils
 	{
+#if false
 		// Usage:
 		//   If you want to re-generate the dumps on your box,
 		//   run this program *under MS.NET*. The resulting
@@ -1789,7 +1790,7 @@ namespace MonoTests.System
 					WriteVarInit (arg, dump, 79);
 			}
 		}
-
+#endif
 		// NOTE: This method doesn't perform any escaping!
 		private static void WriteVarInit (string name, string value, int cut_at)
 		{

+ 2 - 0
mcs/class/corlib/Test/System/ConsoleTest.cs

@@ -330,6 +330,7 @@ public class ConsoleTest
 		Console.WriteLine ("text {0}", (object[]) null);
 	}
 
+#if !MOBILE
 	// Bug 678357
 	[Test]
 	public void EncodingTest ()
@@ -339,5 +340,6 @@ public class ConsoleTest
 		Console.OutputEncoding = Encoding.UTF8;
 		Assert.AreEqual (Console.OutputEncoding, Console.Out.Encoding);
 	}
+#endif
 }
 }

+ 6 - 4
mcs/class/corlib/Test/System/DelegateTest.cs

@@ -5,7 +5,9 @@
 
 using System;
 using System.Reflection;
+#if !MONOTOUCH
 using System.Reflection.Emit;
+#endif
 using System.Threading;
 
 using NUnit.Framework;
@@ -1096,7 +1098,7 @@ namespace MonoTests.System
 				typeof (Action),
 				this.GetType ().GetMethod ("Banga"));
 		}
-
+#if !MONOTOUCH
 		[Test] // #664205
 		public void DynamicInvokeNullTarget ()
 		{
@@ -1109,7 +1111,7 @@ namespace MonoTests.System
 
 			Assert.AreEqual (42, (int) @delegate.DynamicInvoke ());
 		}
-
+#endif
 #endif
 		public static void CreateDelegateOfStaticMethodBoundToNull_Helper (object[] args) {}
 
@@ -1209,7 +1211,7 @@ namespace MonoTests.System
 		{
 			string retarg (string s);
 		}
-
+#if !MONOTOUCH
 		[Test]
 		public void CreateDelegateWithLdFtnAndAbstractMethod ()
 		{
@@ -1245,7 +1247,7 @@ namespace MonoTests.System
 			int a = (int) t.GetMethod ("test").Invoke (obj, null);
 			Assert.AreEqual (3, a, "#1");
 		}
-
+#endif
 		public static int MethodWithIntParam (int x) {
 			return 10;
 		}

+ 3 - 1
mcs/class/corlib/Test/System/EnvironmentCas.cs

@@ -26,6 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !MOBILE
 using NUnit.Framework;
 
 using System;
@@ -384,7 +385,6 @@ namespace MonoCasTests.System {
 			// now that the stack is set, call the methods
 			int i = Environment.ProcessorCount;
 		}
-
 		[Test]
 		[EnvironmentPermission (SecurityAction.Deny, Write = "MONO")]
 		[ExpectedException (typeof (SecurityException))]
@@ -512,3 +512,5 @@ namespace MonoCasTests.System {
 		}
 	}
 }
+
+#endif

+ 0 - 1
mcs/class/corlib/Test/System/ModuleHandleTest.cs

@@ -17,7 +17,6 @@
 using System;
 using System.Threading;
 using System.Reflection;
-using System.Reflection.Emit;
 using System.IO;
 using System.Collections;
 

+ 9 - 5
mcs/class/corlib/Test/System/SingleTest.cs

@@ -15,6 +15,10 @@ using System.Threading;
 
 using NUnit.Framework;
 
+#if !MOBILE
+using NUnit.Framework.SyntaxHelpers;
+#endif
+
 namespace MonoTests.System
 {
 	[TestFixture]
@@ -126,7 +130,7 @@ namespace MonoTests.System
 			Assert.AreEqual (float.Epsilon, result, "Epsilon#1b");
 			Assert.IsTrue (float.TryParse (nan, NumberStyles.Float, CultureInfo.CurrentCulture, out result), "NaN#1a");
 			Assert.AreEqual (float.NaN, result, "NaN#1b");
-			Assert.IsNaN (result, "NaN#1c");
+			Assert.That (result, Is.NaN, "NaN#1c");
 			Assert.IsTrue (float.TryParse (negInf, NumberStyles.Float, CultureInfo.CurrentCulture, out result), "-Inf#1a");
 			Assert.AreEqual (float.NegativeInfinity, result, "-Inf#1b");
 			Assert.IsTrue (float.TryParse (posInf, NumberStyles.Float, CultureInfo.CurrentCulture, out result), "+Inf#1a");
@@ -136,7 +140,7 @@ namespace MonoTests.System
 			Assert.AreEqual (float.MinValue, float.Parse (minVal), "MinValue#2");
 			Assert.AreEqual (float.Epsilon, float.Parse (epsilon), "Epsilon#2");
 			Assert.AreEqual (float.NaN, float.Parse (nan), "NaN#2a");
-			Assert.IsNaN (float.Parse (nan), "NaN#2b");
+			Assert.That (float.Parse (nan), Is.NaN, "NaN#2b");
 			Assert.AreEqual (float.NegativeInfinity, float.Parse (negInf), "-Inf#2");
 			Assert.AreEqual (float.PositiveInfinity, float.Parse (posInf), "+Inf#2");
 
@@ -144,7 +148,7 @@ namespace MonoTests.System
 			Assert.AreEqual (float.MinValue, float.Parse (minVal, CultureInfo.CurrentCulture), "MinValue#3");
 			Assert.AreEqual (float.Epsilon, float.Parse (epsilon, CultureInfo.CurrentCulture), "Epsilon#3");
 			Assert.AreEqual (float.NaN, float.Parse (nan, CultureInfo.CurrentCulture), "NaN#3a");
-			Assert.IsNaN (float.Parse (nan, CultureInfo.CurrentCulture), "NaN#3b");
+			Assert.That (float.Parse (nan, CultureInfo.CurrentCulture), Is.NaN, "NaN#3b");
 			Assert.AreEqual (float.NegativeInfinity, float.Parse (negInf, CultureInfo.CurrentCulture), "-Inf#3");
 			Assert.AreEqual (float.PositiveInfinity, float.Parse (posInf, CultureInfo.CurrentCulture), "+Inf#3");
 
@@ -152,7 +156,7 @@ namespace MonoTests.System
 			Assert.AreEqual (float.MinValue, float.Parse (minVal, NumberStyles.Float), "MinValue#4");
 			Assert.AreEqual (float.Epsilon, float.Parse (epsilon, NumberStyles.Float), "Epsilon#4");
 			Assert.AreEqual (float.NaN, float.Parse (nan, NumberStyles.Float), "NaN#4a");
-			Assert.IsNaN (float.Parse (nan, NumberStyles.Float), "NaN#4b");
+			Assert.That (float.Parse (nan, NumberStyles.Float), Is.NaN, "NaN#4b");
 			Assert.AreEqual (float.NegativeInfinity, float.Parse (negInf, NumberStyles.Float), "-Inf#4");
 			Assert.AreEqual (float.PositiveInfinity, float.Parse (posInf, NumberStyles.Float), "+Inf#4");
 
@@ -160,7 +164,7 @@ namespace MonoTests.System
 			Assert.AreEqual (float.MinValue, float.Parse (minVal, NumberStyles.Float, CultureInfo.CurrentCulture), "MinValue#5");
 			Assert.AreEqual (float.Epsilon, float.Parse (epsilon, NumberStyles.Float, CultureInfo.CurrentCulture), "Epsilon#5");
 			Assert.AreEqual (float.NaN, float.Parse (nan, NumberStyles.Float, CultureInfo.CurrentCulture), "NaN#5a");
-			Assert.IsNaN (float.Parse (nan, NumberStyles.Float, CultureInfo.CurrentCulture), "NaN#5b");
+			Assert.That (float.Parse (nan, NumberStyles.Float, CultureInfo.CurrentCulture), Is.NaN, "NaN#5b");
 			Assert.AreEqual (float.NegativeInfinity, float.Parse (negInf, NumberStyles.Float, CultureInfo.CurrentCulture), "-Inf#5");
 			Assert.AreEqual (float.PositiveInfinity, float.Parse (posInf, NumberStyles.Float, CultureInfo.CurrentCulture), "+Inf#5");
 		}

+ 14 - 8
mcs/class/corlib/Test/System/TypeTest.cs

@@ -14,7 +14,9 @@ using System.Collections;
 using System.Collections.Generic;
 using System.IO;
 using System.Reflection;
+#if !MONOTOUCH
 using System.Reflection.Emit;
+#endif
 using System.Runtime.InteropServices;
 using System.Text;
 using System.Globalization;
@@ -232,12 +234,12 @@ namespace MonoTests.System
 		}
 	}
 
-
 	[TestFixture]
 	public class TypeTest
 	{
-		private AssemblyBuilder assembly;
+#if !MONOTOUCH
 		private ModuleBuilder module;
+#endif
 		const string ASSEMBLY_NAME = "MonoTests.System.TypeTest";
 		static int typeIndexer = 0;
 
@@ -246,9 +248,11 @@ namespace MonoTests.System
 		{
 			AssemblyName assemblyName = new AssemblyName ();
 			assemblyName.Name = ASSEMBLY_NAME;
-			assembly = AppDomain.CurrentDomain.DefineDynamicAssembly (
+#if !MONOTOUCH
+			var assembly = AppDomain.CurrentDomain.DefineDynamicAssembly (
 					assemblyName, AssemblyBuilderAccess.RunAndSave, Path.GetTempPath ());
 			module = assembly.DefineDynamicModule ("module1");
+#endif
 		}
 
 		private string genTypeName ()
@@ -1623,7 +1627,7 @@ namespace MonoTests.System
 			Type [] typeArgs = typeof (List<>).GetGenericArguments ();
 			Assert.IsFalse (typeArgs [0].IsAbstract, "#7");
 		}
-
+#if !MOBILE
 		[Test]
 		public void IsCOMObject ()
 		{
@@ -1650,7 +1654,7 @@ namespace MonoTests.System
 			type = tb.CreateType ();
 			Assert.IsTrue (type.IsImport, "#3");
 		}
-
+#endif
 		[Test]
 		public void IsInterface ()
 		{
@@ -2683,7 +2687,7 @@ PublicKeyToken=b77a5c561934e089"));
 			Assert.IsNull (i);
 		}
 
-#if !TARGET_JVM // Reflection.Emit is not supported for TARGET_JVM
+#if !TARGET_JVM && !MOBILE // Reflection.Emit is not supported for TARGET_JVM
 		[Test]
 		public void EqualsUnderlyingType ()
 		{
@@ -2927,6 +2931,7 @@ PublicKeyToken=b77a5c561934e089"));
 		}
 
 		[Test] //bug #331199
+		[Category ("MobileNotWorking")]
 		public void MakeGenericType_UserDefinedType ()
 		{
 			Type ut = new UserType (typeof (int));
@@ -2967,6 +2972,7 @@ PublicKeyToken=b77a5c561934e089"));
 		}
 		
 		[Test]
+		[Category ("MobileNotWorking")]
 		public void MakeGenericType_BadUserType ()
 		{
 			Type ut = new UserType (null);
@@ -3100,7 +3106,7 @@ PublicKeyToken=b77a5c561934e089"));
 			Assert.AreEqual (t1, t2);
 		}
 
-
+#if !MONOTOUCH
 		[Test]
 		public void Bug506757 ()
 		{
@@ -3145,7 +3151,7 @@ PublicKeyToken=b77a5c561934e089"));
 			foreach (var m in t2.GetMethods (BindingFlags.Instance | BindingFlags.NonPublic))
 				Assert.IsTrue (m.DeclaringType == typeof (object), String.Format ("{0}::{1}", m.DeclaringType, m.Name));
 		}
-
+#endif
 		[Test]
 		public void MakeArrayTypeOfOneDimension ()
 		{