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

@ -88,12 +88,8 @@ namespace MonoTests.System.Reflection
}
[Test] // bug #49114
#if NET_2_0
[Category ("NotWorking")]
[ExpectedException (typeof (ArgumentException))]
#else
[ExpectedException (typeof (TypeLoadException))]
#endif
public void GetType_TypeName_Invalid ()
{
typeof (int).Assembly.GetType ("&blabla", true, true);
@ -104,7 +100,6 @@ namespace MonoTests.System.Reflection
{
Assembly a = typeof (int).Assembly;
string typeName = typeof (string).AssemblyQualifiedName;
#if NET_2_0
try {
a.GetType (typeName, true, false);
Assert.Fail ("#A1");
@ -114,17 +109,6 @@ namespace MonoTests.System.Reflection
Assert.IsNotNull (ex.Message, "#A4");
Assert.IsNull (ex.ParamName, "#A5");
}
#else
try {
a.GetType (typeName, true, false);
Assert.Fail ("#A1");
} catch (TypeLoadException ex) {
Assert.AreEqual (typeof (TypeLoadException), ex.GetType (), "#A2");
Assert.IsNull (ex.InnerException, "#A3");
Assert.IsNotNull (ex.Message, "#A4");
Assert.IsTrue (ex.Message.IndexOf (typeName) != -1, "#A5");
}
#endif
Type type = a.GetType (typeName, false);
Assert.IsNull (type, "#B1");
@ -141,14 +125,10 @@ namespace MonoTests.System.Reflection
string fname = AppDomain.CurrentDomain.FriendlyName;
if (fname.EndsWith (".dll")) { // nunit-console
Assert.IsNull (Assembly.GetEntryAssembly (), "GetEntryAssembly");
#if NET_2_0
Assert.IsFalse (AppDomain.CurrentDomain.IsDefaultAppDomain (), "!default appdomain");
#endif
} else { // gnunit
Assert.IsNotNull (Assembly.GetEntryAssembly (), "GetEntryAssembly");
#if NET_2_0
Assert.IsTrue (AppDomain.CurrentDomain.IsDefaultAppDomain (), "!default appdomain");
#endif
}
}
@ -358,9 +338,6 @@ namespace MonoTests.System.Reflection
}
[Test] // bug #78517
#if ONLY_1_1
[Category ("NotDotNet")] // MS.NET 1.x throws FileLoadException
#endif
public void LoadFrom_Empty_Assembly ()
{
string tempFile = Path.GetTempFileName ();
@ -589,15 +566,11 @@ namespace MonoTests.System.Reflection
Assert.AreEqual ("readme.txt", resInfo.FileName, "#A6");
Assert.IsNull (resInfo.ReferencedAssembly, "#A7");
Assert.AreEqual ((ResourceLocation) 0, resInfo.ResourceLocation, "#A8");
#if NET_2_0
try {
assembly.GetManifestResourceStream ("read");
Assert.Fail ("#A9");
} catch (FileNotFoundException) {
}
#else
Assert.IsNull (assembly.GetManifestResourceStream ("read"), "#A9");
#endif
try {
assembly.GetFile ("readme.txt");
Assert.Fail ("#A10");
@ -621,7 +594,6 @@ namespace MonoTests.System.Reflection
}
}
#if NET_2_0
[Test]
[Category ("NotWorking")]
public void ReflectionOnlyLoad ()
@ -650,7 +622,6 @@ namespace MonoTests.System.Reflection
Assembly assembly = Assembly.ReflectionOnlyLoad (typeof (AssemblyTest).Assembly.FullName);
assembly.CreateInstance ("MonoTests.System.Reflection.AssemblyTest");
}
#endif
[Test]
[Category ("NotWorking")] // patch for bug #79720 must be committed first
@ -760,11 +731,7 @@ namespace MonoTests.System.Reflection
}
[Test] // bug #79712
#if NET_2_0
[Category ("NotWorking")] // in non-default domain, MS throws FileNotFoundException
#else
[Category ("NotWorking")]
#endif
public void Load_Culture_Mismatch ()
{
string tempDir = Path.Combine (Path.GetTempPath (),
@ -787,11 +754,7 @@ namespace MonoTests.System.Reflection
aname = new AssemblyName ();
aname.Name = "bug79712a";
aname.CultureInfo = CultureInfo.InvariantCulture;
#if NET_2_0
Assert.IsTrue (cdt.AssertFileNotFoundException (aname), "#A1");
#else
Assert.IsTrue (cdt.AssertFileLoadException (aname), "#A2");
#endif
// PART B
@ -803,11 +766,7 @@ namespace MonoTests.System.Reflection
aname = new AssemblyName ();
aname.Name = "bug79712b";
aname.CultureInfo = new CultureInfo ("en-US");
#if NET_2_0
Assert.IsTrue (cdt.AssertFileNotFoundException (aname), "#B1");
#else
Assert.IsTrue (cdt.AssertFileLoadException (aname), "#B2");
#endif
} finally {
AppDomain.Unload (ad);
if (Directory.Exists (tempDir))