|
|
@@ -24,13 +24,26 @@ namespace MonoTests.System.Reflection
|
|
|
[TestFixture]
|
|
|
public class ModuleTest
|
|
|
{
|
|
|
- static string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.Reflection.ModuleTest");
|
|
|
+ static string BaseTempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.Reflection.ModuleTest");
|
|
|
+ static string TempFolder;
|
|
|
+
|
|
|
+ [TestFixtureSetUp]
|
|
|
+ public void FixtureSetUp ()
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ // Try to cleanup from any previous NUnit run.
|
|
|
+ Directory.Delete (BaseTempFolder, true);
|
|
|
+ } catch (Exception) {
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
[SetUp]
|
|
|
public void SetUp ()
|
|
|
{
|
|
|
- while (Directory.Exists (TempFolder))
|
|
|
- TempFolder = Path.Combine (TempFolder, "2");
|
|
|
+ int i = 0;
|
|
|
+ do {
|
|
|
+ TempFolder = Path.Combine (BaseTempFolder, (++i).ToString());
|
|
|
+ } while (Directory.Exists (TempFolder));
|
|
|
Directory.CreateDirectory (TempFolder);
|
|
|
}
|
|
|
|
|
|
@@ -38,8 +51,8 @@ public class ModuleTest
|
|
|
public void TearDown ()
|
|
|
{
|
|
|
try {
|
|
|
- // This throws an exception under MS.NET, since the directory contains loaded
|
|
|
- // assemblies.
|
|
|
+ // This throws an exception under MS.NET and Mono on Windows,
|
|
|
+ // since the directory contains loaded assemblies.
|
|
|
Directory.Delete (TempFolder, true);
|
|
|
} catch (Exception) {
|
|
|
}
|