2009-04-27 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / mcs / class / corlib / Test / System.IO / FileTest.cs
index f7e655686105d03354b100e733a5fce0adf97462..172a0ace5224f2b526794b7343d7181150ce2f17 100644 (file)
@@ -9,57 +9,52 @@
 //
 // TODO: Find out why ArgumentOutOfRangeExceptions does not manage to close streams properly
 //
-using NUnit.Framework;
+
 using System;
 using System.IO;
 using System.Globalization;
 using System.Threading;
 
+using NUnit.Framework;
+
 namespace MonoTests.System.IO
 {
        [TestFixture]
-       public class FileTest : Assertion
+       public class FileTest
        {
+               CultureInfo old_culture;
                static string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");
 
                [SetUp]
                public void SetUp ()
                {
-                       if (Directory.Exists (TempFolder))
-                               Directory.Delete (TempFolder, true);
+                       DeleteDirectory (TempFolder);
                        Directory.CreateDirectory (TempFolder);
-               
-                        Thread.CurrentThread.CurrentCulture = new CultureInfo ("EN-us");
+                       old_culture = Thread.CurrentThread.CurrentCulture;
+                       Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
                }
 
                [TearDown]
                public void TearDown ()
                {
-                       if (Directory.Exists (TempFolder))
-                               Directory.Delete (TempFolder, true);
+                       DeleteDirectory (TempFolder);
+                       Thread.CurrentThread.CurrentCulture = old_culture;
                }
 
                [Test]
                public void TestExists ()
                {
-                       int i = 0;
                        FileStream s = null;
                        string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
                        try {
-                               Assert ("null filename should not exist", !File.Exists (null));
-                               i++;
-                               Assert ("empty filename should not exist", !File.Exists (""));
-                               i++;
-                               Assert ("whitespace filename should not exist", !File.Exists ("  \t\t  \t \n\t\n \n"));
-                               i++;                            
+                               Assert.IsFalse (File.Exists (null), "#1");
+                               Assert.IsFalse (File.Exists (string.Empty), "#2");
+                               Assert.IsFalse (File.Exists ("  \t\t  \t \n\t\n \n"), "#3");
                                DeleteFile (path);
                                s = File.Create (path);
                                s.Close ();
-                               Assert ("File " + path + " should exists", File.Exists (path));
-                               i++;
-                               Assert ("File resources" + Path.DirectorySeparatorChar + "doesnotexist should not exist", !File.Exists (TempFolder + Path.DirectorySeparatorChar + "doesnotexist"));
-                       } catch (Exception e) {
-                               Fail ("Unexpected exception at i = " + i + ". e=" + e);
+                               Assert.IsTrue (File.Exists (path), "#4");
+                               Assert.IsFalse (File.Exists (TempFolder + Path.DirectorySeparatorChar + "doesnotexist"), "#5");
                        } finally {
                                if (s != null)
                                        s.Close ();
@@ -70,46 +65,114 @@ namespace MonoTests.System.IO
                [Test]
                public void Exists_InvalidFileName () 
                {
-                       Assert ("><|", !File.Exists ("><|"));
-                       Assert ("?*", !File.Exists ("?*"));
+                       Assert.IsFalse (File.Exists ("><|"), "#1");
+                       Assert.IsFalse (File.Exists ("?*"), "#2");
                }
 
                [Test]
                public void Exists_InvalidDirectory () 
                {
-                       Assert ("InvalidDirectory", !File.Exists (Path.Combine ("does not exist", "file.txt")));
+                       Assert.IsFalse (File.Exists (Path.Combine ("does not exist", "file.txt")));
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentNullException))]
-               public void CtorArgumentNullException1 ()
-               {       
-                       FileStream stream = File.Create (null);
+               public void Create_Path_Null ()
+               {
+                       try {
+                               File.Create (null);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void CtorArgumentException1 ()
-               {       
-                       FileStream stream = File.Create ("");
+               public void Create_Path_Directory ()
+               {
+                       string path = Path.Combine (TempFolder, "foo");
+                       Directory.CreateDirectory (path);
+                       try {
+                               File.Create (path);
+                               Assert.Fail ("#1");
+                       } catch (UnauthorizedAccessException ex) {
+                               // Access to the path '...' is denied
+                               Assert.AreEqual (typeof (UnauthorizedAccessException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
+                       } finally {
+                               DeleteDirectory (path);
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void CtorArgumentException2 ()
-               {       
-                       FileStream stream = File.Create (" ");
+               public void Create_Path_Empty ()
+               {
+                       try {
+                               File.Create (string.Empty);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (DirectoryNotFoundException))]
-               public void CtorDirectoryNotFoundException ()
-               {       
+               public void Create_Path_ReadOnly ()
+               {
+                       string path = Path.Combine (TempFolder, "foo");
+                       File.Create (path).Close ();
+                       File.SetAttributes (path, FileAttributes.ReadOnly);
+                       try {
+                               File.Create (path);
+                               Assert.Fail ("#1");
+                       } catch (UnauthorizedAccessException ex) {
+                               // Access to the path '...' is denied
+                               Assert.AreEqual (typeof (UnauthorizedAccessException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
+                       } finally {
+                               File.SetAttributes (path, FileAttributes.Normal);
+                       }
+               }
+
+               [Test]
+               public void Create_Path_Whitespace ()
+               {
+                       try {
+                               File.Create (" ");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
+               }
+
+               [Test]
+               public void Create_Directory_DoesNotExist ()
+               {
                        FileStream stream = null;
                        string path = TempFolder + Path.DirectorySeparatorChar + "directory_does_not_exist" + Path.DirectorySeparatorChar + "foo";
                        
                        try {
                                stream = File.Create (path);
+                               Assert.Fail ("#1");
+                       } catch (DirectoryNotFoundException ex) {
+                               // Could not find a part of the path "..."
+                               Assert.AreEqual (typeof (DirectoryNotFoundException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
                        } finally {
                                if (stream != null)
                                        stream.Close ();
@@ -118,35 +181,32 @@ namespace MonoTests.System.IO
                }
 
                [Test]
-               public void TestCreate ()
+               public void Create ()
                {
                        FileStream stream = null;
-                       string path = "";
+                       string path = null;
+
                        /* positive test: create resources/foo */
+                       path = TempFolder + Path.DirectorySeparatorChar + "foo";
                        try {
-                               path = TempFolder + Path.DirectorySeparatorChar + "foo";
+
                                stream = File.Create (path);
-                               Assert ("File should exist", File.Exists (path));
+                               Assert.IsTrue (File.Exists (path), "#1");
                                stream.Close ();
-                       } catch (Exception e) {
-                               Fail ("File.Create(resources/foo) unexpected exception caught: e=" + e.ToString());
                        } finally {
                                if (stream != null)
                                        stream.Close ();
                                DeleteFile (path);
                        }
-                       
-                       path = "";
+
                        stream = null;
 
                        /* positive test: repeat test above again to test for overwriting file */
+                       path = TempFolder + Path.DirectorySeparatorChar + "foo";
                        try {
-                               path = TempFolder + Path.DirectorySeparatorChar + "foo";
                                stream = File.Create (path);
-                               Assert ("File should exist", File.Exists (path));
+                               Assert.IsTrue (File.Exists (path), "#2");
                                stream.Close ();
-                       } catch (Exception e) {
-                               Fail ("File.Create(resources/foo) unexpected exception caught: e=" + e.ToString()); 
                        } finally {
                                if (stream != null)
                                        stream.Close ();
@@ -155,253 +215,635 @@ namespace MonoTests.System.IO
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentNullException))]
-               public void CopyArgumentNullException1 ()
+               public void Copy_SourceFileName_Null ()
                {
-                       File.Copy (null, "b");
+                       try {
+                               File.Copy (null, "b");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("sourceFileName", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentNullException))]
-               public void CopyArgumentNullException2 ()
+               public void Copy_DestFileName_Null ()
                {
-                       File.Copy ("a", null);
+                       try {
+                               File.Copy ("a", null);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("destFileName", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]
-               public void CopyArgumentException1 ()
+               public void Copy_SourceFileName_Empty ()
                {
-                       File.Copy ("", "b");
+                       try {
+                               File.Copy (string.Empty, "b");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("sourceFileName", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]
-               public void CopyArgumentException2 ()
+               public void Copy_DestFileName_Empty ()
                {
-                       File.Copy ("a", "");
+                       try {
+                               File.Copy ("a", string.Empty);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("destFileName", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]
-               public void CopyArgumentException3 ()
+               public void Copy_SourceFileName_Whitespace ()
                {
-                       File.Copy (" ", "b");
+                       try {
+                               File.Copy (" ", "b");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]
-               public void CopyArgumentException4 ()
+               public void Copy_DestFileName_Whitespace ()
                {
-                       File.Copy ("a", " ");
+                       try {
+                               File.Copy ("a", " ");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(FileNotFoundException))]
-               public void CopyFileNotFoundException ()
+               public void Copy_SourceFileName_DoesNotExist ()
                {
-                       File.Copy ("doesnotexist", "b");
+                       try {
+                               File.Copy ("doesnotexist", "b");
+                               Assert.Fail ("#1");
+                       } catch (FileNotFoundException ex) {
+                               Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
+                               Assert.AreEqual ("doesnotexist", ex.FileName, "#3");
+                               Assert.IsNull (ex.InnerException, "#4");
+                               Assert.IsNotNull (ex.Message, "#5");
+                       }
                }
 
-               [ExpectedException(typeof(IOException))]
-               public void CopyIOException ()
+               [Test]
+               public void Copy_DestFileName_AlreadyExists ()
                {
-                       DeleteFile (TempFolder + Path.DirectorySeparatorChar + "bar");
-                       DeleteFile (TempFolder + Path.DirectorySeparatorChar + "AFile.txt");
+                       string source = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
+                       string dest = TempFolder + Path.DirectorySeparatorChar + "bar";
+                       DeleteFile (source);
+                       DeleteFile (dest);
                        try {
-                               File.Create (TempFolder + Path.DirectorySeparatorChar + "AFile.txt").Close ();
-                               File.Copy (TempFolder + Path.DirectorySeparatorChar + "AFile.txt", TempFolder + Path.DirectorySeparatorChar + "bar");
-                               File.Copy (TempFolder + Path.DirectorySeparatorChar + "AFile.txt", TempFolder + Path.DirectorySeparatorChar + "bar");
+                               File.Create (source).Close ();
+                               File.Copy (source, dest);
+                               try {
+                                       File.Copy (source, dest);
+                                       Assert.Fail ("#1");
+                               } catch (IOException ex) {
+                                       // The file '...' already exists.
+                                       Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsTrue (ex.Message.IndexOf (dest) != -1, "#5");
+                               }
                        } finally {
-                               DeleteFile (TempFolder + Path.DirectorySeparatorChar + "bar");
-                               DeleteFile (TempFolder + Path.DirectorySeparatorChar + "AFile.txt");                            
+                               DeleteFile (dest);
+                               DeleteFile (source);
                        }
                }
 
                [Test]
-               public void TestCopy ()
+               public void Copy ()
                {
                        string path1 = TempFolder + Path.DirectorySeparatorChar + "bar";
                        string path2 = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
                        /* positive test: copy resources/AFile.txt to resources/bar */
                        try {
-                               try {
-                                       DeleteFile (path1);
-                                       DeleteFile (path2);
-
-                                       File.Create (path2).Close ();
-                                       File.Copy (path2, path1);
-                                       Assert ("File AFile.txt should still exist", File.Exists (path2));
-                                       Assert ("File bar should exist after File.Copy", File.Exists (path1));
-                               } catch (Exception e) {
-                                       Fail ("#1 File.Copy('resources/AFile.txt', 'resources/bar') unexpected exception caught: e=" + e.ToString());
-                               }
+                               DeleteFile (path1);
+                               DeleteFile (path2);
 
-                               /* positive test: copy resources/AFile.txt to resources/bar, overwrite */
-                               try {
-                                       Assert ("File bar should exist before File.Copy", File.Exists (path1));
-                                       File.Copy (path2, path1, true);
-                                       Assert ("File AFile.txt should still exist", File.Exists (path2));
-                                       Assert ("File bar should exist after File.Copy", File.Exists (path1));
-                               } catch (Exception e) {
-                                       Fail ("File.Copy('resources/AFile.txt', 'resources/bar', true) unexpected exception caught: e=" + e.ToString());
-                               }
-                       }finally {
+                               File.Create (path2).Close ();
+                               File.Copy (path2, path1);
+                               Assert.IsTrue (File.Exists (path2), "#A1");
+                               Assert.IsTrue (File.Exists (path1), "#A2");
+
+                               Assert.IsTrue (File.Exists (path1), "#B1");
+                               File.Copy (path2, path1, true);
+                               Assert.IsTrue (File.Exists (path2), "#B2");
+                               Assert.IsTrue (File.Exists (path1), "#B3");
+                       } finally {
                                DeleteFile (path1);
                                DeleteFile (path2);
-                       }                       
+                       }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
-               public void DeleteArgumentNullException ()
+               public void Delete_Path_Null ()
                {
-                       File.Delete (null);
+                       try {
+                               File.Delete (null);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
-               public void DeleteArgumentException1 ()
+               public void Delete_Path_Empty ()
                {
-                       File.Delete ("");
+                       try {
+                               File.Delete (string.Empty);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
-               public void DeleteArgumentException2 ()
+               public void Delete_Path_Whitespace ()
                {
-                       File.Delete (" ");
+                       try {
+                               File.Delete (" ");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException (typeof (DirectoryNotFoundException))]
-               public void DeleteDirectoryNotFoundException ()
+               public void Delete_Directory_DoesNotExist ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "directory_does_not_exist" + Path.DirectorySeparatorChar + "foo";
                        if (Directory.Exists (path))
                                Directory.Delete (path, true);
-                       File.Delete (path);                     
-               }
 
+                       try {
+                               File.Delete (path);
+                               Assert.Fail ("#1");
+                       } catch (DirectoryNotFoundException ex) {
+                               // Could not find a part of the path "..."
+                               Assert.AreEqual (typeof (DirectoryNotFoundException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
+                       }
+               }
 
                [Test]
-               public void TestDelete ()
+               public void Delete ()
                {
                        string foopath = TempFolder + Path.DirectorySeparatorChar + "foo";
                        DeleteFile (foopath);
                        try {
                                File.Create (foopath).Close ();
-
-                               try {
-                                       File.Delete (foopath);
-                               } catch (Exception e) {
-                                       Fail ("Unable to delete " + foopath + " e=" + e.ToString());
-                               } 
-                               Assert ("File " + foopath + " should not exist after File.Delete", !File.Exists (foopath));
+                               File.Delete (foopath);
+                               Assert.IsFalse (File.Exists (foopath));
+                               File.Delete (foopath);
                        } finally {
-                               DeleteFile (foopath);
+                               DeleteFile (foopath);
                        }
                }
 
-               [Test]
-               [ExpectedException(typeof (IOException))]
-               [Category("NotWorking")]
-               public void DeleteOpenStreamException ()
+               [Test] // bug #323389
+               [Category ("NotWorking")]
+               public void Delete_FileLock ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "DeleteOpenStreamException";
-                       DeleteFile (path);                      
+                       DeleteFile (path);
                        FileStream stream = null;
                        try {
                                stream = new FileStream (path, FileMode.OpenOrCreate, FileAccess.ReadWrite);
-                               File.Delete (path);
+                               try {
+                                       File.Delete (path);
+                                       Assert.Fail ("#1");
+                               } catch (IOException ex) {
+                                       // The process cannot access the file '...'
+                                       // because it is being used by another process
+                                       Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
+                               }
                        } finally {
                                if (stream != null)
                                        stream.Close ();
                                DeleteFile (path);
                        }
                }
-               
+
+               [Test]
+               [ExpectedException (typeof(UnauthorizedAccessException))]
+               public void Delete_File_ReadOnly ()
+               {
+                       string path = TempFolder + Path.DirectorySeparatorChar + "DeleteReadOnly";
+                       DeleteFile (path);
+                       try {
+                               File.Create (path).Close ();
+                               File.SetAttributes (path, FileAttributes.ReadOnly);
+                               File.Delete (path);
+                       } finally {
+                               File.SetAttributes (path, FileAttributes.Normal);
+                               DeleteFile (path);
+                       }
+               }
+
+               [Test]
+               public void GetAttributes_Archive ()
+               {
+                       if (RunningOnUnix)
+                               Assert.Ignore ("bug #325181: FileAttributes.Archive has no effect on Unix.");
+
+                       FileAttributes attrs;
+
+                       string path = Path.Combine (TempFolder, "GetAttributes.tmp");
+                       File.Create (path).Close ();
+
+                       attrs = File.GetAttributes (path);
+                       Assert.IsTrue ((attrs & FileAttributes.Archive) != 0, "#1");
+
+                       attrs &= ~FileAttributes.Archive;
+                       File.SetAttributes (path, attrs);
+
+                       attrs = File.GetAttributes (path);
+                       Assert.IsFalse ((attrs & FileAttributes.Archive) != 0, "#2");
+               }
+
+               [Test]
+               public void GetAttributes_Default_File ()
+               {
+                       if (RunningOnUnix)
+                               Assert.Ignore ("bug #325181: FileAttributes.Archive has no effect on Unix.");
+
+                       string path = Path.Combine (TempFolder, "GetAttributes.tmp");
+                       File.Create (path).Close ();
+
+                       FileAttributes attrs = File.GetAttributes (path);
+
+                       Assert.IsTrue ((attrs & FileAttributes.Archive) != 0, "#1");
+                       Assert.IsFalse ((attrs & FileAttributes.Directory) != 0, "#2");
+                       Assert.IsFalse ((attrs & FileAttributes.Hidden) != 0, "#3");
+                       Assert.IsFalse ((attrs & FileAttributes.Normal) != 0, "#4");
+                       Assert.IsFalse ((attrs & FileAttributes.ReadOnly) != 0, "#5");
+                       Assert.IsFalse ((attrs & FileAttributes.System) != 0, "#6");
+               }
+
+               [Test]
+               public void GetAttributes_Default_Directory ()
+               {
+                       FileAttributes attrs = File.GetAttributes (TempFolder);
+
+                       Assert.IsFalse ((attrs & FileAttributes.Archive) != 0, "#1");
+                       Assert.IsTrue ((attrs & FileAttributes.Directory) != 0, "#2");
+                       Assert.IsFalse ((attrs & FileAttributes.Hidden) != 0, "#3");
+                       Assert.IsFalse ((attrs & FileAttributes.Normal) != 0, "#4");
+                       Assert.IsFalse ((attrs & FileAttributes.ReadOnly) != 0, "#5");
+                       Assert.IsFalse ((attrs & FileAttributes.System) != 0, "#6");
+               }
+
+               [Test]
+               public void GetAttributes_Directory ()
+               {
+                       FileAttributes attrs = File.GetAttributes (TempFolder);
+
+                       Assert.IsTrue ((attrs & FileAttributes.Directory) != 0, "#1");
+
+                       attrs &= ~FileAttributes.Directory;
+                       File.SetAttributes (TempFolder, attrs);
+
+                       Assert.IsFalse ((attrs & FileAttributes.Directory) != 0, "#2");
+
+                       string path = Path.Combine (TempFolder, "GetAttributes.tmp");
+                       File.Create (path).Close ();
+
+                       attrs = File.GetAttributes (path);
+                       attrs |= FileAttributes.Directory;
+                       File.SetAttributes (path, attrs);
+
+                       Assert.IsTrue ((attrs & FileAttributes.Directory) != 0, "#3");
+               }
+
+               [Test]
+               public void GetAttributes_ReadOnly ()
+               {
+                       FileAttributes attrs;
+
+                       string path = Path.Combine (TempFolder, "GetAttributes.tmp");
+                       File.Create (path).Close ();
+
+                       attrs = File.GetAttributes (path);
+                       Assert.IsFalse ((attrs & FileAttributes.ReadOnly) != 0, "#1");
+
+                       try {
+                               attrs |= FileAttributes.ReadOnly;
+                               File.SetAttributes (path, attrs);
+
+                               attrs = File.GetAttributes (path);
+                               Assert.IsTrue ((attrs & FileAttributes.ReadOnly) != 0, "#2");
+                       } finally {
+                               File.SetAttributes (path, FileAttributes.Normal);
+                       }
+               }
+
+               [Test]
+               public void GetAttributes_System ()
+               {
+                       if (RunningOnUnix)
+                               Assert.Ignore ("FileAttributes.System is not supported on Unix.");
+
+                       FileAttributes attrs;
+
+                       string path = Path.Combine (TempFolder, "GetAttributes.tmp");
+                       File.Create (path).Close ();
+
+                       attrs = File.GetAttributes (path);
+                       Assert.IsFalse ((attrs & FileAttributes.System) != 0, "#1");
+
+                       attrs |= FileAttributes.System;
+                       File.SetAttributes (path, FileAttributes.System);
+
+                       attrs = File.GetAttributes (path);
+                       Assert.IsTrue ((attrs & FileAttributes.System) != 0, "#2");
+               }
+
+               [Test]
+               public void GetAttributes_Path_DoesNotExist ()
+               {
+                       string path = Path.Combine (TempFolder, "GetAttributes.tmp");
+                       try {
+                               File.GetAttributes (path);
+                               Assert.Fail ("#1");
+                       } catch (FileNotFoundException ex) {
+                               Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
+                               Assert.AreEqual (path, ex.FileName, "#3");
+                               Assert.IsNull (ex.InnerException, "#4");
+                               Assert.IsNotNull (ex.Message, "#5");
+                       }
+               }
+
+               [Test]
+               public void GetAttributes_Path_Empty ()
+               {
+                       try {
+                               File.GetAttributes (string.Empty);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
+               }
+
+               [Test]
+               public void GetAttributes_Path_Null ()
+               {
+                       try {
+                               File.GetAttributes (null);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
+               }
+
                [Test]
-               [ExpectedException(typeof (ArgumentNullException))]
-               public void MoveException1 ()
+               public void Move_SourceFileName_Null ()
                {
-                       File.Move (null, "b");
+                       try {
+                               File.Move (null, "b");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("sourceFileName", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentNullException))]
-               public void MoveException2 ()
+               public void Move_DestFileName_Null ()
                {
-                       File.Move ("a", null);
+                       try {
+                               File.Move ("a", null);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("destFileName", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void MoveException3 ()
+               public void Move_SourceFileName_Empty ()
                {
-                       File.Move ("", "b");
+                       try {
+                               File.Move (string.Empty, "b");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("sourceFileName", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void MoveException4 ()
+               public void Move_DestFileName_Empty ()
                {
-                       File.Move ("a", "");
+                       try {
+                               File.Move ("a", string.Empty);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("destFileName", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void MoveException5 ()
+               public void Move_SourceFileName_Whitespace ()
                {
-                        File.Move (" ", "b");                  
+                       try {
+                               File.Move (" ", "b");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void MoveException6 ()
+               public void Move_DestFileName_Whitespace ()
                {
-                       File.Move ("a", " ");
+                       try {
+                               File.Move ("a", " ");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (FileNotFoundException))]
-               public void MoveException7 ()
+               public void Move_SourceFileName_DoesNotExist ()
                {
-                               DeleteFile (TempFolder + Path.DirectorySeparatorChar + "doesnotexist");                 
-                        File.Move (TempFolder + Path.DirectorySeparatorChar + "doesnotexist", "b");
+                       string file = TempFolder + Path.DirectorySeparatorChar + "doesnotexist";
+                       DeleteFile (file);
+                       try {
+                               File.Move (file, "b");
+                               Assert.Fail ("#1");
+                       } catch (FileNotFoundException ex) {
+                               Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
+                               Assert.AreEqual (file, ex.FileName, "#3");
+                               Assert.IsNull (ex.InnerException, "#4");
+                               Assert.IsNotNull (ex.Message, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (DirectoryNotFoundException))]
-               public void MoveException8 ()
+               public void Move_DestFileName_DirectoryDoesNotExist ()
                {
-                       string path = TempFolder + Path.DirectorySeparatorChar + "foo";
-                        DeleteFile (path);
+                       string sourceFile = TempFolder + Path.DirectorySeparatorChar + "foo";
+                       string destFile = Path.Combine (Path.Combine (TempFolder, "doesnotexist"), "b");
+                       DeleteFile (sourceFile);
                        try {
-                               File.Create (TempFolder + Path.DirectorySeparatorChar + "AFile.txt").Close ();
-                               File.Copy(TempFolder + Path.DirectorySeparatorChar + "AFile.txt", path, true);
-                               DeleteFile (TempFolder + Path.DirectorySeparatorChar + "doesnotexist" + Path.DirectorySeparatorChar + "b");
-                               File.Move (TempFolder + Path.DirectorySeparatorChar + "foo", TempFolder + Path.DirectorySeparatorChar + "doesnotexist" + Path.DirectorySeparatorChar + "b");
+                               File.Create (sourceFile).Close ();
+                               try {
+                                       File.Move (sourceFile, destFile);
+                                       Assert.Fail ("#1");
+                               } catch (DirectoryNotFoundException ex) {
+                                       // Could not find a part of the path
+                                       Assert.AreEqual (typeof (DirectoryNotFoundException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+#if NET_2_0
+                                       Assert.IsFalse (ex.Message.IndexOf (destFile) != -1, "#5");
+#else
+                                       Assert.IsTrue (ex.Message.IndexOf (destFile) != -1, "#5");
+#endif
+                               }
                        } finally {
-                               DeleteFile (TempFolder + Path.DirectorySeparatorChar + "AFile.txt");
-                               DeleteFile (path);
+                               DeleteFile (sourceFile);
                        }
                }
 
                [Test]
-               [ExpectedException(typeof (IOException))]
-               public void MoveException9 ()
+               public void Move_DestFileName_AlreadyExists ()
                {
-                       File.Create (TempFolder + Path.DirectorySeparatorChar + "foo").Close ();
+                       string sourceFile = TempFolder + Path.DirectorySeparatorChar + "foo";
+                       string destFile;
+
+                       // move to same directory
+                       File.Create (sourceFile).Close ();
                        try {
-                               File.Move (TempFolder + Path.DirectorySeparatorChar + "foo", TempFolder);               
+                               File.Move (sourceFile, TempFolder);
+                               Assert.Fail ("#A1");
+                       } catch (IOException ex) {
+                               // Cannot create a file when that file already exists
+                               Assert.AreEqual (typeof (IOException), ex.GetType (), "#A2");
+                               Assert.IsNull (ex.InnerException, "#A3");
+                               Assert.IsNotNull (ex.Message, "#A4");
+                               Assert.IsFalse (ex.Message.IndexOf (sourceFile) != -1, "#A5");
+                               Assert.IsFalse (ex.Message.IndexOf (TempFolder) != -1, "#A6");
                        } finally {
-                               DeleteFile (TempFolder + Path.DirectorySeparatorChar + "foo");
+                               DeleteFile (sourceFile);
+                       }
+
+                       // move to exist file
+                       File.Create (sourceFile).Close ();
+                       destFile = TempFolder + Path.DirectorySeparatorChar + "bar";
+                       File.Create (destFile).Close ();
+                       try {
+                               File.Move (sourceFile, destFile);
+                               Assert.Fail ("#B1");
+                       } catch (IOException ex) {
+                               // Cannot create a file when that file already exists
+                               Assert.AreEqual (typeof (IOException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                               Assert.IsFalse (ex.Message.IndexOf (sourceFile) != -1, "#B5");
+                               Assert.IsFalse (ex.Message.IndexOf (destFile) != -1, "#B6");
+                       } finally {
+                               DeleteFile (sourceFile);
+                               DeleteFile (destFile);
+                       }
+
+                       // move to existing directory
+                       File.Create (sourceFile).Close ();
+                       destFile = TempFolder + Path.DirectorySeparatorChar + "bar";
+                       Directory.CreateDirectory (destFile);
+                       try {
+                               File.Move (sourceFile, destFile);
+                               Assert.Fail ("#C1");
+                       } catch (IOException ex) {
+                               // Cannot create a file when that file already exists
+                               Assert.AreEqual (typeof (IOException), ex.GetType (), "#C2");
+                               Assert.IsNull (ex.InnerException, "#C3");
+                               Assert.IsNotNull (ex.Message, "#C4");
+                               Assert.IsFalse (ex.Message.IndexOf (sourceFile) != -1, "#C5");
+                               Assert.IsFalse (ex.Message.IndexOf (destFile) != -1, "#C6");
+                       } finally {
+                               DeleteFile (sourceFile);
+                               DeleteDirectory (destFile);
                        }
                }
 
                [Test]
-               public void TestMove ()
+               public void Move ()
                {
                        string bar = TempFolder + Path.DirectorySeparatorChar + "bar";
                        string baz = TempFolder + Path.DirectorySeparatorChar + "baz";
@@ -410,10 +852,10 @@ namespace MonoTests.System.IO
                                f.Close();
                        }
                        
-                       Assert ("File " + TempFolder + Path.DirectorySeparatorChar + "bar should exist", File.Exists (bar));
+                       Assert.IsTrue (File.Exists (bar), "#1");
                        File.Move (bar, baz);
-                       Assert ("File " + TempFolder + Path.DirectorySeparatorChar + "bar should not exist", !File.Exists (bar));
-                       Assert ("File " + TempFolder + Path.DirectorySeparatorChar + "baz should exist", File.Exists (baz));
+                       Assert.IsFalse (File.Exists (bar), "#2");
+                       Assert.IsTrue (File.Exists (baz), "#3");
 
                        // Test moving of directories
                        string dir = Path.Combine (TempFolder, "dir");
@@ -423,12 +865,12 @@ namespace MonoTests.System.IO
 
                        if (Directory.Exists (dir))
                                Directory.Delete (dir, true);
-                                               
+
                        Directory.CreateDirectory (dir);
                        Directory.CreateDirectory (dir2);
                        File.Create (dir_foo).Close ();
                        File.Move (dir_foo, dir2_foo);
-                       Assert (File.Exists (dir2_foo));
+                       Assert.IsTrue (File.Exists (dir2_foo), "#4");
                        
                        Directory.Delete (dir, true);
                        Directory.Delete (dir2, true);
@@ -437,36 +879,291 @@ namespace MonoTests.System.IO
                }
 
                [Test]
-               public void TestOpen ()
+               public void Move_FileLock ()
+               {
+                       string sourceFile = Path.GetTempFileName ();
+                       string destFile = Path.GetTempFileName ();
+
+                       // source file locked
+                       using (File.Open (sourceFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None)) {
+                               try {
+                                       File.Move (sourceFile, destFile);
+                                       Assert.Fail ("#A1");
+                               } catch (IOException ex) {
+                                       // The process cannot access the file because
+                                       // it is being used by another process
+                                       Assert.AreEqual (typeof (IOException), ex.GetType (), "#A2");
+                                       Assert.IsNull (ex.InnerException, "#A3");
+                                       Assert.IsNotNull (ex.Message, "#A4");
+                               }
+                       }
+
+                       // destination file locked
+                       using (File.Open (destFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None)) {
+                               try {
+                                       File.Move (sourceFile, destFile);
+                                       Assert.Fail ("#B1");
+                               } catch (IOException ex) {
+                                       // The process cannot access the file because
+                                       // it is being used by another process
+                                       Assert.AreEqual (typeof (IOException), ex.GetType (), "#B2");
+                                       Assert.IsNull (ex.InnerException, "#B3");
+                                       Assert.IsNotNull (ex.Message, "#B4");
+                               }
+                       }
+               }
+
+               [Test]
+               public void Open ()
+               {
+                       string path = null;
+                       FileStream stream = null;
+
+                       path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
+                       try {
+                               if (!File.Exists (path))
+                                       stream = File.Create (path);
+                               stream.Close ();
+                               stream = File.Open (path, FileMode.Open);
+                               stream.Close ();
+                       } finally {
+                               if (stream != null)
+                                       stream.Close ();
+                               DeleteFile (path);
+                       }
+
+                       stream = null;
+
+                       if (!File.Exists (path))
+                               File.Create (path).Close ();
+                       try {
+                               stream = File.Open (path, FileMode.Open);
+                               Assert.IsTrue (stream.CanRead, "#A1");
+                               Assert.IsTrue (stream.CanSeek, "#A2");
+                               Assert.IsTrue (stream.CanWrite, "#A3");
+                               stream.Close ();
+
+                               stream = File.Open (path, FileMode.Open, FileAccess.Write);
+                               Assert.IsFalse (stream.CanRead, "#B1");
+                               Assert.IsTrue (stream.CanSeek, "#B2");
+                               Assert.IsTrue (stream.CanWrite, "#B3");
+                               stream.Close ();
+
+                               stream = File.Open (path, FileMode.Open, FileAccess.Read);
+                               Assert.IsTrue (stream.CanRead, "#C1");
+                               Assert.IsTrue (stream.CanSeek, "#C2");
+                               Assert.IsFalse (stream.CanWrite, "#C3");
+                               stream.Close ();
+                       } finally {
+                               if (stream != null)
+                                       stream.Close ();
+                               DeleteFile (path);
+                       }
+
+                       stream = null;
+
+                       /* Exception tests */
+                       path = TempFolder + Path.DirectorySeparatorChar + "filedoesnotexist";
+                       try {
+                               stream = File.Open (path, FileMode.Open);
+                               Assert.Fail ("#D1");
+                       } catch (FileNotFoundException ex) {
+                               Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#D2");
+                               Assert.AreEqual (path, ex.FileName, "#D3");
+                               Assert.IsNull (ex.InnerException, "#D4");
+                               Assert.IsNotNull (ex.Message, "#D5");
+                       } finally {
+                               if (stream != null)
+                                       stream.Close ();
+                               DeleteFile (path);
+                       }
+               }
+
+               [Test]
+               public void Open_CreateNewMode_ReadAccess ()
+               {
+                       string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
+                       FileStream stream = null;
+                       try {
+                               stream = File.Open (TempFolder + Path.DirectorySeparatorChar + "AFile.txt", FileMode.CreateNew, FileAccess.Read);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Combining FileMode: CreateNew with FileAccess: Read is invalid
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       } finally {
+                               if (stream != null)
+                                       stream.Close ();
+                               DeleteFile (path);
+                       }
+               }
+
+               [Test]
+               public void Open_AppendMode_ReadAccess ()
+               {
+                       string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
+                       FileStream s = null;
+                       if (!File.Exists (path))
+                               File.Create (path).Close ();
+                       try {
+                               s = File.Open (path, FileMode.Append, FileAccess.Read);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Combining FileMode: Append with FileAccess: Read is invalid
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       } finally {
+                               if (s != null)
+                                       s.Close ();
+                               DeleteFile (path);
+                       }
+               }
+
+               [Test]
+               public void OpenRead ()
+               {
+                       string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
+                       if (!File.Exists (path))
+                               File.Create (path).Close ();
+                       FileStream stream = null;
+                       
+                       try {
+                               stream = File.OpenRead (path);
+                               Assert.IsTrue (stream.CanRead, "#1");
+                               Assert.IsTrue (stream.CanSeek, "#2");
+                               Assert.IsFalse (stream.CanWrite, "#3");
+                       } finally {
+                               if (stream != null)
+                                       stream.Close ();
+                               DeleteFile (path);
+                       }
+               }
+
+               [Test]
+               public void OpenWrite ()
+               {
+                       string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
+                       if (!File.Exists (path))
+                               File.Create (path).Close ();
+                       FileStream stream = null;
+
+                       try {
+                               stream = File.OpenWrite (path);
+                               Assert.IsFalse (stream.CanRead, "#1");
+                               Assert.IsTrue (stream.CanSeek, "#2");
+                               Assert.IsTrue (stream.CanWrite, "#3");
+                               stream.Close ();
+                       } finally {
+                               if (stream != null)
+                                       stream.Close ();
+                               DeleteFile (path);
+                       }
+               }
+
+               [Test]
+               [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
+               public void TestGetCreationTime ()
+               {
+                       string path = TempFolder + Path.DirectorySeparatorChar + "baz";
+                       DeleteFile (path);
+
+                       try {
+                               File.Create (path).Close();
+                               DateTime time = File.GetCreationTime (path);
+                               Assert.IsTrue ((DateTime.Now - time).TotalSeconds < 10);
+                       } finally {
+                               DeleteFile (path);
+                       }
+               }
+
+               [Test]
+               [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
+               public void CreationTime ()
                {
-                       string path = "";
+                       if (RunningOnUnix)
+                               Assert.Ignore ("Setting the creation time on Unix is not possible.");
+
+                       string path = Path.GetTempFileName ();
+                       try {
+                               File.SetCreationTime (path, new DateTime (2002, 4, 6, 4, 6, 4));
+                               DateTime time = File.GetCreationTime (path);
+                               Assert.AreEqual (2002, time.Year, "#A1");
+                               Assert.AreEqual (4, time.Month, "#A2");
+                               Assert.AreEqual (6, time.Day, "#A3");
+                               Assert.AreEqual (4, time.Hour, "#A4");
+                               Assert.AreEqual (4, time.Second, "#A5");
+
+                               time = TimeZone.CurrentTimeZone.ToLocalTime (File.GetCreationTimeUtc (path));
+                               Assert.AreEqual (2002, time.Year, "#B1");
+                               Assert.AreEqual (4, time.Month, "#B2");
+                               Assert.AreEqual (6, time.Day, "#B3");
+                               Assert.AreEqual (4, time.Hour, "#B4");
+                               Assert.AreEqual (4, time.Second, "#B5");
+
+                               File.SetCreationTimeUtc (path, new DateTime (2002, 4, 6, 4, 6, 4));
+                               time = File.GetCreationTimeUtc (path);
+                               Assert.AreEqual (2002, time.Year, "#C1");
+                               Assert.AreEqual (4, time.Month, "#C2");
+                               Assert.AreEqual (6, time.Day, "#C3");
+                               Assert.AreEqual (4, time.Hour, "#C4");
+                               Assert.AreEqual (4, time.Second, "#C5");
+
+                               time = TimeZone.CurrentTimeZone.ToUniversalTime (File.GetCreationTime (path));
+                               Assert.AreEqual (2002, time.Year, "#D1");
+                               Assert.AreEqual (4, time.Month, "#D2");
+                               Assert.AreEqual (6, time.Day, "#D3");
+                               Assert.AreEqual (4, time.Hour, "#D4");
+                               Assert.AreEqual (4, time.Second, "#D5");
+                       } finally {
+                               DeleteFile (path);
+                       }
+               }
+
+               [Test]
+               [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM
+               public void LastAccessTime ()
+               {
+                       string path = TempFolder + Path.DirectorySeparatorChar + "lastAccessTime";
+                       if (File.Exists (path))
+                               File.Delete (path);
                        FileStream stream = null;
-                        try {
-                               path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
-                               if (!File.Exists (path))
-                                       stream = File.Create (path);
-                               stream.Close ();
-                                stream = File.Open (path, FileMode.Open);
-                               stream.Close ();
-                        } catch (Exception e) {
-                                Fail ("Unable to open " + TempFolder + Path.DirectorySeparatorChar + "AFile.txt: e=" + e.ToString());
-                        } finally {
-                               if (stream != null)
-                                       stream.Close ();
-                               DeleteFile (path);
-                        }
-                       
-                       path = "";
-                       stream = null;
-                        /* Exception tests */
                        try {
-                               path = TempFolder + Path.DirectorySeparatorChar + "filedoesnotexist";
-                               stream = File.Open (path, FileMode.Open);
-                               Fail ("File 'filedoesnotexist' should not exist");
-                       } catch (FileNotFoundException) {
-                               // do nothing, this is what we expect
-                       } catch (Exception e) {
-                               Fail ("Unexpect exception caught: e=" + e.ToString());
+                               stream = File.Create (path);
+                               stream.Close ();
+
+                               File.SetLastAccessTime (path, new DateTime (2002, 4, 6, 4, 6, 4));
+                               DateTime time = File.GetLastAccessTime (path);
+                               Assert.AreEqual (2002, time.Year, "#A1");
+                               Assert.AreEqual (4, time.Month, "#A2");
+                               Assert.AreEqual (6, time.Day, "#A3");
+                               Assert.AreEqual (4, time.Hour, "#A4");
+                               Assert.AreEqual (4, time.Second, "#A5");
+
+                               time = TimeZone.CurrentTimeZone.ToLocalTime (File.GetLastAccessTimeUtc (path));
+                               Assert.AreEqual (2002, time.Year, "#B1");
+                               Assert.AreEqual (4, time.Month, "#B2");
+                               Assert.AreEqual (6, time.Day, "#B3");
+                               Assert.AreEqual (4, time.Hour, "#B4");
+                               Assert.AreEqual (4, time.Second, "#B5");
+
+                               File.SetLastAccessTimeUtc (path, new DateTime (2002, 4, 6, 4, 6, 4));
+                               time = File.GetLastAccessTimeUtc (path);
+                               Assert.AreEqual (2002, time.Year, "#C1");
+                               Assert.AreEqual (4, time.Month, "#C2");
+                               Assert.AreEqual (6, time.Day, "#C3");
+                               Assert.AreEqual (4, time.Hour, "#C4");
+                               Assert.AreEqual (4, time.Second, "#C5");
+
+                               time = TimeZone.CurrentTimeZone.ToUniversalTime (File.GetLastAccessTime (path));
+                               Assert.AreEqual (2002, time.Year, "#D1");
+                               Assert.AreEqual (4, time.Month, "#D2");
+                               Assert.AreEqual (6, time.Day, "#D3");
+                               Assert.AreEqual (4, time.Hour, "#D4");
+                               Assert.AreEqual (4, time.Second, "#D5");
                        } finally {
                                if (stream != null)
                                        stream.Close ();
@@ -474,530 +1171,595 @@ namespace MonoTests.System.IO
                        }
                }
 
-                [Test]
-                public void Open () 
-                {
-                       string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
-                       if (!File.Exists (path))
-                               File.Create (path).Close ();
-                       FileStream stream = null;
-                       try {
-                       
-                               stream = File.Open (path, FileMode.Open);
-                       
-                               Assertion.AssertEquals ("test#01", true, stream.CanRead);
-                               Assertion.AssertEquals ("test#02", true, stream.CanSeek);
-                               Assertion.AssertEquals ("test#03", true, stream.CanWrite);
-                               stream.Close ();
-                       
-                               stream = File.Open (path, FileMode.Open, FileAccess.Write);
-                               Assertion.AssertEquals ("test#04", false, stream.CanRead);
-                               Assertion.AssertEquals ("test#05", true, stream.CanSeek);
-                               Assertion.AssertEquals ("test#06", true, stream.CanWrite);
-                               stream.Close ();
-                                       
-                               stream = File.Open (path, FileMode.Open, FileAccess.Read);
-                               Assertion.AssertEquals ("test#04", true, stream.CanRead);
-                               Assertion.AssertEquals ("test#05", true, stream.CanSeek);
-                               Assertion.AssertEquals ("test#06", false, stream.CanWrite);
-                               stream.Close ();
-                               
-                       } finally {
-                               if (stream != null)
-                                       stream.Close ();
-                               DeleteFile (path);
-                       }
-                }
-                
-                [Test]
-                [ExpectedException(typeof(ArgumentException))]
-                public void OpenException1 ()
-                {
-                       string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
-                       FileStream stream = null;
-                       // CreateNew + Read throws an exceptoin
-                       try {
-                               stream = File.Open (TempFolder + Path.DirectorySeparatorChar + "AFile.txt", FileMode.CreateNew, FileAccess.Read);
-                       } finally {
-                               if (stream != null)
-                                       stream.Close ();
-                               DeleteFile (path);
-                       }
-                }
-
-                [Test]
-                [ExpectedException(typeof(ArgumentException))]
-                public void OpenException2 ()
-                {
-                       string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
-                       FileStream s = null;
-                       // Append + Read throws an exceptoin
-                       if (!File.Exists (path))
-                               File.Create (path).Close ();
-                       try {
-                               s = File.Open (path, FileMode.Append, FileAccess.Read);
-                       } finally {
-                               if (s != null)
-                                       s.Close ();
-                               DeleteFile (path);
-                       }
-                }
-                
-                [Test]
-                public void OpenRead ()
-                {
-                       string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
-                       if (!File.Exists (path))
-                               File.Create (path).Close ();
-                       FileStream stream = null;
-                       
-                       try {
-                               stream = File.OpenRead (path);
-                       
-                               Assertion.AssertEquals ("test#01", true, stream.CanRead);
-                               Assertion.AssertEquals ("test#02", true, stream.CanSeek);
-                               Assertion.AssertEquals ("test#03", false, stream.CanWrite);
-                               
-                       } finally {
-                               if (stream != null)
-                                       stream.Close ();
-                               DeleteFile (path);
-                       }
-                }
-
-                [Test]
-                public void OpenWrite ()
-                {
-                       string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
-                       if (!File.Exists (path))
-                               File.Create (path).Close ();
-                       FileStream stream = null;
-                       
-                       try {
-                               stream = File.OpenWrite (path);
-                               Assertion.AssertEquals ("test#01", false, stream.CanRead);
-                               Assertion.AssertEquals ("test#02", true, stream.CanSeek);
-                               Assertion.AssertEquals ("test#03", true, stream.CanWrite);
-                               stream.Close ();                                                                        
-                       } finally {
-                               if (stream != null)
-                                       stream.Close ();
-                               DeleteFile (path);
-                       }
-                }
-
                [Test]
-               public void TestGetCreationTime ()
+               public void LastWriteTime ()
                {
-                        string path = TempFolder + Path.DirectorySeparatorChar + "baz";
-                       DeleteFile (path);
-                       
-                       try {
-                               File.Create (path).Close();
-                               DateTime time = File.GetCreationTime (path);
-                               Assert ("GetCreationTime incorrect", (DateTime.Now - time).TotalSeconds < 10);
-                       } finally {
-                               DeleteFile (path);
-                       }
-               }
-
-                [Test]
-                [ExpectedException(typeof(IOException))]
-                public void TestGetCreationTimeException ()
-                {
-                        // Test nonexistent files
-                        string path2 = TempFolder + Path.DirectorySeparatorChar + "filedoesnotexist";
-                       DeleteFile (path2);
-                        // should throw an exception
-                        File.GetCreationTime (path2);
-                }
-                
-
-
-               // Setting the creation time on Unix is not possible
-                [Test][Category("NotWorking")]
-                public void CreationTime ()
-                {
-                        string path = TempFolder + Path.DirectorySeparatorChar + "creationTime";                       
-                        if (File.Exists (path))
-                               File.Delete (path);
-                        FileStream stream = null;      
-                               
-                               try {
-                                       stream = File.Create (path);
-                               stream.Close ();                        
-                       
-                               File.SetCreationTime (path, new DateTime (2002, 4, 6, 4, 6, 4));
-                               DateTime time = File.GetCreationTime (path);
-                               Assertion.AssertEquals ("test#01", 2002, time.Year);
-                               Assertion.AssertEquals ("test#02", 4, time.Month);
-                               Assertion.AssertEquals ("test#03", 6, time.Day);
-                               Assertion.AssertEquals ("test#04", 4, time.Hour);
-                               Assertion.AssertEquals ("test#05", 4, time.Second);
-                       
-                               time = TimeZone.CurrentTimeZone.ToLocalTime (File.GetCreationTimeUtc (path));
-                               Assertion.AssertEquals ("test#06", 2002, time.Year);
-                               Assertion.AssertEquals ("test#07", 4, time.Month);
-                               Assertion.AssertEquals ("test#08", 6, time.Day);
-                               Assertion.AssertEquals ("test#09", 4, time.Hour);
-                               Assertion.AssertEquals ("test#10", 4, time.Second);                     
-
-                               File.SetCreationTimeUtc (path, new DateTime (2002, 4, 6, 4, 6, 4));
-                               time = File.GetCreationTimeUtc (path);
-                               Assertion.AssertEquals ("test#11", 2002, time.Year);
-                               Assertion.AssertEquals ("test#12", 4, time.Month);
-                               Assertion.AssertEquals ("test#13", 6, time.Day);
-                               Assertion.AssertEquals ("test#14", 4, time.Hour);
-                               Assertion.AssertEquals ("test#15", 4, time.Second);
-                       
-                               time = TimeZone.CurrentTimeZone.ToUniversalTime (File.GetCreationTime (path));
-                               Assertion.AssertEquals ("test#16", 2002, time.Year);
-                               Assertion.AssertEquals ("test#17", 4, time.Month);
-                               Assertion.AssertEquals ("test#18", 6, time.Day);
-                               Assertion.AssertEquals ("test#19", 4, time.Hour);
-                               Assertion.AssertEquals ("test#20", 4, time.Second);
-                               } finally {
-                                       if (stream != null)
-                                               stream.Close ();
-                                       DeleteFile (path);
-                               }
-                }
-
-                [Test]
-                public void LastAccessTime ()
-                {
-                        string path = TempFolder + Path.DirectorySeparatorChar + "lastAccessTime";                     
-                        if (File.Exists (path))
-                               File.Delete (path);
+                       string path = TempFolder + Path.DirectorySeparatorChar + "lastWriteTime";
+                       if (File.Exists (path))
+                               File.Delete (path);
                        FileStream stream = null;
-                       try {
-                                       stream = File.Create (path);
-                               stream.Close ();                        
-                       
-                               File.SetLastAccessTime (path, new DateTime (2002, 4, 6, 4, 6, 4));
-                               DateTime time = File.GetLastAccessTime (path);
-                               Assertion.AssertEquals ("test#01", 2002, time.Year);
-                               Assertion.AssertEquals ("test#02", 4, time.Month);
-                               Assertion.AssertEquals ("test#03", 6, time.Day);
-                               Assertion.AssertEquals ("test#04", 4, time.Hour);
-                               Assertion.AssertEquals ("test#05", 4, time.Second);
-                       
-                               time = TimeZone.CurrentTimeZone.ToLocalTime (File.GetLastAccessTimeUtc (path));
-                               Assertion.AssertEquals ("test#06", 2002, time.Year);
-                               Assertion.AssertEquals ("test#07", 4, time.Month);
-                               Assertion.AssertEquals ("test#08", 6, time.Day);
-                               Assertion.AssertEquals ("test#09", 4, time.Hour);
-                               Assertion.AssertEquals ("test#10", 4, time.Second);                     
-       
-                               File.SetLastAccessTimeUtc (path, new DateTime (2002, 4, 6, 4, 6, 4));
-                               time = File.GetLastAccessTimeUtc (path);
-                               Assertion.AssertEquals ("test#11", 2002, time.Year);
-                               Assertion.AssertEquals ("test#12", 4, time.Month);
-                               Assertion.AssertEquals ("test#13", 6, time.Day);
-                               Assertion.AssertEquals ("test#14", 4, time.Hour);
-                               Assertion.AssertEquals ("test#15", 4, time.Second);
-                       
-                               time = TimeZone.CurrentTimeZone.ToUniversalTime (File.GetLastAccessTime (path));
-                               Assertion.AssertEquals ("test#16", 2002, time.Year);
-                               Assertion.AssertEquals ("test#17", 4, time.Month);
-                               Assertion.AssertEquals ("test#18", 6, time.Day);
-                               Assertion.AssertEquals ("test#19", 4, time.Hour);
-                               Assertion.AssertEquals ("test#20", 4, time.Second);
-                       } finally {
-                               if (stream != null)
-                                       stream.Close ();
-                               DeleteFile (path);                                      
-                       }
-                }
-                
-                [Test]
-                public void LastWriteTime ()
-                {
-                        string path = TempFolder + Path.DirectorySeparatorChar + "lastWriteTime";                      
-                        if (File.Exists (path))
-                               File.Delete (path);
-                       FileStream stream = null;
-                       try {
-                                       stream = File.Create (path);
-                               stream.Close ();                        
-                       
-                               File.SetLastWriteTime (path, new DateTime (2002, 4, 6, 4, 6, 4));
-                               DateTime time = File.GetLastWriteTime (path);
-                               Assertion.AssertEquals ("test#01", 2002, time.Year);
-                               Assertion.AssertEquals ("test#02", 4, time.Month);
-                               Assertion.AssertEquals ("test#03", 6, time.Day);
-                               Assertion.AssertEquals ("test#04", 4, time.Hour);
-                               Assertion.AssertEquals ("test#05", 4, time.Second);
-                               
-                               time = TimeZone.CurrentTimeZone.ToLocalTime (File.GetLastWriteTimeUtc (path));
-                               Assertion.AssertEquals ("test#06", 2002, time.Year);
-                               Assertion.AssertEquals ("test#07", 4, time.Month);
-                               Assertion.AssertEquals ("test#08", 6, time.Day);
-                               Assertion.AssertEquals ("test#09", 4, time.Hour);
-                               Assertion.AssertEquals ("test#10", 4, time.Second);                     
-       
-                               File.SetLastWriteTimeUtc (path, new DateTime (2002, 4, 6, 4, 6, 4));
-                               time = File.GetLastWriteTimeUtc (path);
-                               Assertion.AssertEquals ("test#11", 2002, time.Year);
-                               Assertion.AssertEquals ("test#12", 4, time.Month);
-                               Assertion.AssertEquals ("test#13", 6, time.Day);
-                               Assertion.AssertEquals ("test#14", 4, time.Hour);
-                               Assertion.AssertEquals ("test#15", 4, time.Second);
-                               
-                               time = TimeZone.CurrentTimeZone.ToUniversalTime (File.GetLastWriteTime (path));
-                               Assertion.AssertEquals ("test#16", 2002, time.Year);
-                               Assertion.AssertEquals ("test#17", 4, time.Month);
-                               Assertion.AssertEquals ("test#18", 6, time.Day);
-                               Assertion.AssertEquals ("test#19", 4, time.Hour);
-                               Assertion.AssertEquals ("test#20", 4, time.Second);
-                       } finally {
-                               if (stream != null)
-                                       stream.Close ();
-                               DeleteFile (path);
-                       }
-                }
+                       try {
+                               stream = File.Create (path);
+                               stream.Close ();
+
+                               File.SetLastWriteTime (path, new DateTime (2002, 4, 6, 4, 6, 4));
+                               DateTime time = File.GetLastWriteTime (path);
+                               Assert.AreEqual (2002, time.Year, "#A1");
+                               Assert.AreEqual (4, time.Month, "#A2");
+                               Assert.AreEqual (6, time.Day, "#A3");
+                               Assert.AreEqual (4, time.Hour, "#A4");
+                               Assert.AreEqual (4, time.Second, "#A5");
+
+                               time = TimeZone.CurrentTimeZone.ToLocalTime (File.GetLastWriteTimeUtc (path));
+                               Assert.AreEqual (2002, time.Year, "#B1");
+                               Assert.AreEqual (4, time.Month, "#B2");
+                               Assert.AreEqual (6, time.Day, "#B3");
+                               Assert.AreEqual (4, time.Hour, "#B4");
+                               Assert.AreEqual (4, time.Second, "#B5");
+
+                               File.SetLastWriteTimeUtc (path, new DateTime (2002, 4, 6, 4, 6, 4));
+                               time = File.GetLastWriteTimeUtc (path);
+                               Assert.AreEqual (2002, time.Year, "#C1");
+                               Assert.AreEqual (4, time.Month, "#C2");
+                               Assert.AreEqual (6, time.Day, "#C3");
+                               Assert.AreEqual (4, time.Hour, "#C4");
+                               Assert.AreEqual (4, time.Second, "#C5");
+
+                               time = TimeZone.CurrentTimeZone.ToUniversalTime (File.GetLastWriteTime (path));
+                               Assert.AreEqual (2002, time.Year, "#D1");
+                               Assert.AreEqual (4, time.Month, "#D2");
+                               Assert.AreEqual (6, time.Day, "#D3");
+                               Assert.AreEqual (4, time.Hour, "#D4");
+                               Assert.AreEqual (4, time.Second, "#D5");
+                       } finally {
+                               if (stream != null)
+                                       stream.Close ();
+                               DeleteFile (path);
+                       }
+               }
 
                [Test]
-               [ExpectedException(typeof(ArgumentNullException))]      
-               public void GetCreationTimeException1 ()
+               [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
+               public void GetCreationTime_Path_Null ()
                {
-                       File.GetCreationTime (null as string);
+                       try {
+                               File.GetCreationTime (null as string);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetCreationTimeException2 ()
+               [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
+               public void GetCreationTime_Path_Empty ()
                {
-                       File.GetCreationTime ("");
+                       try {
+                               File.GetCreationTime (string.Empty);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
        
                [Test]
-               [ExpectedException(typeof(IOException))]
-               public void GetCreationTimeException3 ()
+               //[Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
+               public void GetCreationTime_Path_DoesNotExist ()
                {
-                        string path = TempFolder + Path.DirectorySeparatorChar + "GetCreationTimeException3";                  
-                       DeleteFile (path);              
-                       File.GetCreationTime (path);
+                       string path = TempFolder + Path.DirectorySeparatorChar + "GetCreationTimeException3";
+                       DeleteFile (path);
+
+#if NET_2_0
+                       DateTime time = File.GetCreationTime (path);
+                       DateTime expectedTime = (new DateTime (1601, 1, 1)).ToLocalTime ();
+                       Assert.AreEqual (expectedTime.Year, time.Year, "#1");
+                       Assert.AreEqual (expectedTime.Month, time.Month, "#2");
+                       Assert.AreEqual (expectedTime.Day, time.Day, "#3");
+                       Assert.AreEqual (expectedTime.Hour, time.Hour, "#4");
+                       Assert.AreEqual (expectedTime.Second, time.Second, "#5");
+                       Assert.AreEqual (expectedTime.Millisecond, time.Millisecond, "#6");
+#else
+                       try {
+                               File.GetCreationTime (path);
+                               Assert.Fail ("#1");
+                       } catch (IOException ex) {
+                               // Could not find a part of the path "..."
+                               Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsTrue (ex.Message.IndexOf ("\"" + path + "\"") != -1, "#5");
+                       }
+#endif
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetCreationTimeException4 ()
+               [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
+               public void GetCreationTime_Path_Whitespace ()
                {
-                       File.GetCreationTime ("    ");
+                       try {
+                               File.GetCreationTime ("    ");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetCreationTimeException5 ()
+               [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
+               public void GetCreationTime_Path_InvalidPathChars ()
                {
-                       File.GetCreationTime (Path.InvalidPathChars [0].ToString ());
+                       try {
+                               File.GetCreationTime (Path.InvalidPathChars [0].ToString ());
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Illegal characters in path
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentNullException))]      
-               public void GetCreationTimeUtcException1 ()
+               [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
+               public void GetCreationTimeUtc_Path_Null ()
                {
-                       File.GetCreationTimeUtc (null as string);
+                       try {
+                               File.GetCreationTimeUtc (null as string);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetCreationTimeUtcException2 ()
+               [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
+               public void GetCreationTimeUtc_Path_Empty ()
                {
-                       File.GetCreationTimeUtc ("");
+                       try {
+                               File.GetCreationTimeUtc (string.Empty);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
        
                [Test]
-               [ExpectedException(typeof(IOException))]
-               public void GetCreationTimeUtcException3 ()
+               [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
+               public void GetCreationTimeUtc_Path_DoesNotExist ()
                {
-                        string path = TempFolder + Path.DirectorySeparatorChar + "GetCreationTimeUtcException3";                       
-                       DeleteFile (path);              
-                       File.GetCreationTimeUtc (path);
+                       string path = TempFolder + Path.DirectorySeparatorChar + "GetCreationTimeUtcException3";
+                       DeleteFile (path);
+
+#if NET_2_0
+                       DateTime time = File.GetCreationTimeUtc (path);
+                       Assert.AreEqual (1601, time.Year, "#1");
+                       Assert.AreEqual (1, time.Month, "#2");
+                       Assert.AreEqual (1, time.Day, "#3");
+                       Assert.AreEqual (0, time.Hour, "#4");
+                       Assert.AreEqual (0, time.Second, "#5");
+                       Assert.AreEqual (0, time.Millisecond, "#6");
+#else
+                       try {
+                               File.GetCreationTimeUtc (path);
+                               Assert.Fail ("#1");
+                       } catch (IOException ex) {
+                               // Could not find a part of the path "..."
+                               Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsTrue (ex.Message.IndexOf ("\"" + path + "\"") != -1, "#5");
+                       }
+#endif
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetCreationTimeUtcException4 ()
+               [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
+               public void GetCreationTimeUtc_Path_Whitespace ()
                {
-                       File.GetCreationTimeUtc ("    ");
+                       try {
+                               File.GetCreationTimeUtc ("    ");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetCreationTimeUtcException5 ()
+               [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
+               public void GetCreationTimeUtc_Path_InvalidPathChars ()
                {
-                       File.GetCreationTime (Path.InvalidPathChars [0].ToString ());
+                       try {
+                               File.GetCreationTimeUtc (Path.InvalidPathChars [0].ToString ());
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Illegal characters in path
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentNullException))]      
-               public void GetLastAccessTimeException1 ()
+               [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM
+               public void GetLastAccessTime_Path_Null ()
                {
-                       File.GetLastAccessTime (null as string);
+                       try {
+                               File.GetLastAccessTime (null as string);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetLastAccessTimeException2 ()
+               [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM
+               public void GetLastAccessTime_Path_Empty ()
                {
-                       File.GetLastAccessTime ("");
+                       try {
+                               File.GetLastAccessTime (string.Empty);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
        
                [Test]
-               [ExpectedException(typeof(IOException))]
-               public void GetLastAccessTimeException3 ()
+               [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM
+               public void GetLastAccessTime_Path_DoesNotExist ()
                {
-                        string path = TempFolder + Path.DirectorySeparatorChar + "GetLastAccessTimeException3";                        
-                       DeleteFile (path);              
-                       File.GetLastAccessTime (path);
+                       string path = TempFolder + Path.DirectorySeparatorChar + "GetLastAccessTimeException3";
+                       DeleteFile (path);
+
+#if NET_2_0
+                       DateTime time = File.GetLastAccessTime (path);
+                       DateTime expectedTime = (new DateTime (1601, 1, 1)).ToLocalTime ();
+                       Assert.AreEqual (expectedTime.Year, time.Year, "#1");
+                       Assert.AreEqual (expectedTime.Month, time.Month, "#2");
+                       Assert.AreEqual (expectedTime.Day, time.Day, "#3");
+                       Assert.AreEqual (expectedTime.Hour, time.Hour, "#4");
+                       Assert.AreEqual (expectedTime.Second, time.Second, "#5");
+                       Assert.AreEqual (expectedTime.Millisecond, time.Millisecond, "#6");
+#else
+                       try {
+                               File.GetLastAccessTime (path);
+                               Assert.Fail ("#1");
+                       } catch (IOException ex) {
+                               // Could not find a part of the path "..."
+                               Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsTrue (ex.Message.IndexOf ("\"" + path + "\"") != -1, "#5");
+                       }
+#endif
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetLastAccessTimeException4 ()
+               [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM
+               public void GetLastAccessTime_Path_Whitespace ()
                {
-                       File.GetLastAccessTime ("    ");
+                       try {
+                               File.GetLastAccessTime ("    ");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetLastAccessTimeException5 ()
+               [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM
+               public void GetLastAccessTime_Path_InvalidPathChars ()
                {
-                       File.GetLastAccessTime (Path.InvalidPathChars [0].ToString ());
+                       try {
+                               File.GetLastAccessTime (Path.InvalidPathChars [0].ToString ());
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Illegal characters in path
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentNullException))]      
-               public void GetLastAccessTimeUtcException1 ()
+               [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM
+               public void GetLastAccessTimeUtc_Path_Null ()
                {
-                       File.GetLastAccessTimeUtc (null as string);
+                       try {
+                               File.GetLastAccessTimeUtc (null as string);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetLastAccessTimeUtcException2 ()
+               [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM
+               public void GetLastAccessTimeUtc_Path_Empty ()
                {
-                       File.GetLastAccessTimeUtc ("");
+                       try {
+                               File.GetLastAccessTimeUtc (string.Empty);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
        
                [Test]
-               [ExpectedException(typeof(IOException))]
-               public void GetLastAccessTimeUtcException3 ()
+               [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM
+               public void GetLastAccessTimeUtc_Path_DoesNotExist ()
                {
-                        string path = TempFolder + Path.DirectorySeparatorChar + "GetLastAccessTimeUtcException3";                     
-                       DeleteFile (path);                      
-                       File.GetLastAccessTimeUtc (path);
+                       string path = TempFolder + Path.DirectorySeparatorChar + "GetLastAccessTimeUtcException3";
+                       DeleteFile (path);
+
+#if NET_2_0
+                       DateTime time = File.GetLastAccessTimeUtc (path);
+                       Assert.AreEqual (1601, time.Year, "#1");
+                       Assert.AreEqual (1, time.Month, "#2");
+                       Assert.AreEqual (1, time.Day, "#3");
+                       Assert.AreEqual (0, time.Hour, "#4");
+                       Assert.AreEqual (0, time.Second, "#5");
+                       Assert.AreEqual (0, time.Millisecond, "#6");
+#else
+                       try {
+                               File.GetLastAccessTimeUtc (path);
+                               Assert.Fail ("#1");
+                       } catch (IOException ex) {
+                               // Could not find a part of the path "..."
+                               Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsTrue (ex.Message.IndexOf ("\"" + path + "\"") != -1, "#5");
+                       }
+#endif
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetLastAccessTimeUtcException4 ()
+               [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM
+               public void GetLastAccessTimeUtc_Path_Whitespace ()
                {
-                       File.GetLastAccessTimeUtc ("    ");
+                       try {
+                               File.GetLastAccessTimeUtc ("    ");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetLastAccessTimeUtcException5 ()
+               [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM
+               public void GetLastAccessTimeUtc_Path_InvalidPathChars ()
                {
-                       File.GetLastAccessTimeUtc (Path.InvalidPathChars [0].ToString ());
+                       try {
+                               File.GetLastAccessTimeUtc (Path.InvalidPathChars [0].ToString ());
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Illegal characters in path
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentNullException))]      
-               public void GetLastWriteTimeException1 ()
+               public void GetLastWriteTime_Path_Null ()
                {
-                       File.GetLastWriteTime (null as string);
+                       try {
+                               File.GetLastWriteTime (null as string);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetLastWriteTimeException2 ()
+               public void GetLastWriteTime_Path_Empty ()
                {
-                       File.GetLastWriteTime ("");
+                       try {
+                               File.GetLastWriteTime (string.Empty);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
        
                [Test]
-               [ExpectedException(typeof(IOException))]
-               public void GetLastWriteTimeException3 ()
+               public void GetLastWriteTime_Path_DoesNotExist ()
                {
-                        string path = TempFolder + Path.DirectorySeparatorChar + "GetLastAccessTimeUtcException3";                     
-                       DeleteFile (path);                      
-                       File.GetLastWriteTime (path);
+                       string path = TempFolder + Path.DirectorySeparatorChar + "GetLastAccessTimeUtcException3";
+                       DeleteFile (path);
+
+#if NET_2_0
+                       DateTime time = File.GetLastWriteTime (path);
+                       DateTime expectedTime = (new DateTime (1601, 1, 1)).ToLocalTime ();
+                       Assert.AreEqual (expectedTime.Year, time.Year, "#1");
+                       Assert.AreEqual (expectedTime.Month, time.Month, "#2");
+                       Assert.AreEqual (expectedTime.Day, time.Day, "#3");
+                       Assert.AreEqual (expectedTime.Hour, time.Hour, "#4");
+                       Assert.AreEqual (expectedTime.Second, time.Second, "#5");
+                       Assert.AreEqual (expectedTime.Millisecond, time.Millisecond, "#6");
+#else
+                       try {
+                               File.GetLastWriteTime (path);
+                               Assert.Fail ("#1");
+                       } catch (IOException ex) {
+                               // Could not find a part of the path "..."
+                               Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsTrue (ex.Message.IndexOf ("\"" + path + "\"") != -1, "#5");
+                       }
+#endif
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetLastWriteTimeException4 ()
+               public void GetLastWriteTime_Path_Whitespace ()
                {
-                       File.GetLastWriteTime ("    ");
+                       try {
+                               File.GetLastWriteTime ("    ");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetLastWriteTimeException5 ()
+               public void GetLastWriteTime_Path_InvalidPathChars ()
                {
-                       File.GetLastWriteTime (Path.InvalidPathChars [0].ToString ());
+                       try {
+                               File.GetLastWriteTime (Path.InvalidPathChars [0].ToString ());
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Illegal characters in path
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentNullException))]      
-               public void GetLastWriteTimeUtcException1 ()
+               public void GetLastWriteTimeUtc_Path_Null ()
                {
-                       File.GetLastWriteTimeUtc (null as string);
+                       try {
+                               File.GetLastWriteTimeUtc (null as string);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetLastWriteTimeUtcException2 ()
+               public void GetLastWriteTimeUtc_Path_Empty ()
                {
-                       File.GetLastAccessTimeUtc ("");
+                       try {
+                               File.GetLastWriteTimeUtc (string.Empty);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
        
                [Test]
-               [ExpectedException(typeof(IOException))]
-               public void GetLastWriteTimeUtcException3 ()
+               public void GetLastWriteTimeUtc_Path_DoesNotExist ()
                {
-                        string path = TempFolder + Path.DirectorySeparatorChar + "GetLastWriteTimeUtcException3";
+                       string path = TempFolder + Path.DirectorySeparatorChar + "GetLastWriteTimeUtcException3";
                        DeleteFile (path);
-                       File.GetLastAccessTimeUtc (path);
-               }
 
-               [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetLastWriteTimeUtcException4 ()
-               {
-                       File.GetLastAccessTimeUtc ("    ");
+#if NET_2_0
+                       DateTime time = File.GetLastWriteTimeUtc (path);
+                       Assert.AreEqual (1601, time.Year, "#1");
+                       Assert.AreEqual (1, time.Month, "#2");
+                       Assert.AreEqual (1, time.Day, "#3");
+                       Assert.AreEqual (0, time.Hour, "#4");
+                       Assert.AreEqual (0, time.Second, "#5");
+                       Assert.AreEqual (0, time.Millisecond, "#6");
+#else
+                       try {
+                               File.GetLastWriteTimeUtc (path);
+                               Assert.Fail ("#1");
+                       } catch (IOException ex) {
+                               // Could not find a part of the path "..."
+                               Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsTrue (ex.Message.IndexOf ("\"" + path + "\"") != -1, "#5");
+                       }
+#endif
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentException))]  
-               public void GetLastWriteTimeUtcException5 ()
+               public void GetLastWriteTimeUtc_Path_Whitespace ()
                {
-                       File.GetLastAccessTimeUtc (Path.InvalidPathChars [0].ToString ());
-               }               
+                       try {
+                               File.GetLastWriteTimeUtc ("    ");
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
+               }
 
                [Test]
-               [ExpectedException(typeof(IOException))]
-               [Category("ValueAdd")]
-               //
-               // This is category ValueAdd, since in Unix the semantics allow for
-               // a file to be deleted while a handle to it remains.
-               //
-               public void FileStreamCloseException ()
+               public void GetLastWriteTimeUtc_Path_InvalidPathChars ()
                {
-                       string path = TempFolder + Path.DirectorySeparatorChar + "FileStreamCloseException";
-                       DeleteFile (path);                      
-                       FileStream stream = null;
                        try {
-                               stream = File.Create (path);
-                               File.Delete (path);
-                       } finally {
-                               if (stream != null)
-                                       stream.Close ();
-                               DeleteFile (path);
+                               File.GetLastWriteTimeUtc (Path.InvalidPathChars [0].ToString ());
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Illegal characters in path
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
                        }
                }
 
@@ -1020,44 +1782,88 @@ namespace MonoTests.System.IO
                // SetCreationTime and SetCreationTimeUtc exceptions
 
                [Test]
-               [ExpectedException(typeof (ArgumentNullException))]
-               public void SetCreationTimeArgumentNullException1 ()
+               [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM
+               public void SetCreationTime_Path_Null ()
                {
-                       File.SetCreationTime (null as string, new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetCreationTime (null as string, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void SetCreationTimeArgumenException1 ()
+               [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM
+               public void SetCreationTime_Path_Empty ()
                {
-                       File.SetCreationTime ("", new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetCreationTime (string.Empty, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void SetCreationTimeArgumenException2 ()
+               [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM
+               public void SetCreationTime_Path_Whitespace ()
                {
-                       File.SetCreationTime ("     ", new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetCreationTime ("     ", new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               [Category("ValueAdd")]
-               // On Unix there are no invalid path chars.
-               public void SetCreationTimeArgumenException3 ()
+               [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM
+               public void SetCreationTime_Path_InvalidPathChars ()
                {
-
-                       File.SetCreationTime (Path.InvalidPathChars [1].ToString (), new DateTime (2000, 12, 12, 11, 59, 59));
+                       // On Unix there are no invalid path chars.
+                       if (Path.InvalidPathChars.Length > 1) {
+                               try {
+                                       File.SetCreationTime (Path.InvalidPathChars [1].ToString (),
+                                               new DateTime (2000, 12, 12, 11, 59, 59));
+                                       Assert.Fail ("#1");
+                               } catch (ArgumentException ex) {
+                                       // Illegal characters in path
+                                       Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsNull (ex.ParamName, "#5");
+                               }
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (FileNotFoundException))]
-               public void SetCreationTimeFileNotFoundException1 ()
+               [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM
+               public void SetCreationTime_Path_DoesNotExist ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "SetCreationTimeFileNotFoundException1";
                        DeleteFile (path);
                        
-                       File.SetCreationTime (path, new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetCreationTime (path, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (FileNotFoundException ex) {
+                               Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
+                               Assert.AreEqual (path, ex.FileName, "#3");
+                               Assert.IsNull (ex.InnerException, "#4");
+                               Assert.IsNotNull (ex.Message, "#5");
+                       }
                }
 
 //             [Test]
@@ -1079,15 +1885,25 @@ namespace MonoTests.System.IO
 //             }
 
                [Test]
-               [ExpectedException(typeof (IOException))]
-               public void SetCreationTimeIOException1 ()
+               [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM
+               public void SetCreationTime_FileLock ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "CreationTimeIOException1";
                        DeleteFile (path);
                        FileStream stream = null;
                        try {
                                stream = File.Create (path);
-                               File.SetCreationTime (path, new DateTime (1000, 12, 12, 11, 59, 59));
+                               try {
+                                       File.SetCreationTime (path, new DateTime (1000, 12, 12, 11, 59, 59));
+                                       Assert.Fail ("#1");
+                               } catch (IOException ex) {
+                                       // The process cannot access the file '...'
+                                       // because it is being used by another process
+                                       Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
+                               }
                        } finally {
                                if (stream != null)
                                        stream.Close ();
@@ -1096,43 +1912,88 @@ namespace MonoTests.System.IO
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentNullException))]
-               public void SetCreationTimeUtcArgumentNullException1 ()
-               {
-                       File.SetCreationTimeUtc (null as string, new DateTime (2000, 12, 12, 11, 59, 59));
+               [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM
+               public void SetCreationTimeUtc_Path_Null ()
+               { 
+                       try {
+                               File.SetCreationTimeUtc (null as string, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void SetCreationTimeUtcArgumenException1 ()
+               [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM
+               public void SetCreationTimeUtc_Path_Empty ()
                {
-                       File.SetCreationTimeUtc ("", new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetCreationTimeUtc (string.Empty, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void SetCreationTimeUtcArgumenException2 ()
+               [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM
+               public void SetCreationTimeUtc_Path_Whitespace ()
                {
-                       File.SetCreationTimeUtc ("     ", new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetCreationTimeUtc ("     ", new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               [Category("ValueAdd")]
-               // On Unix there are no invalid path chars.
-               public void SetCreationTimeUtcArgumenException3 ()
+               [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM
+               public void SetCreationTimeUtc_Path_InvalidPathChars ()
                {
-                       File.SetCreationTimeUtc (Path.InvalidPathChars [1].ToString (), new DateTime (2000, 12, 12, 11, 59, 59));
+                       // On Unix there are no invalid path chars.
+                       if (Path.InvalidPathChars.Length > 1) {
+                               try {
+                                       File.SetCreationTimeUtc (Path.InvalidPathChars [1].ToString (),
+                                               new DateTime (2000, 12, 12, 11, 59, 59));
+                                       Assert.Fail ("#1");
+                               } catch (ArgumentException ex) {
+                                       // Illegal characters in path
+                                       Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsNull (ex.ParamName, "#5");
+                               }
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (FileNotFoundException))]
-               public void SetCreationTimeUtcFileNotFoundException1 ()
+               [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM
+               public void SetCreationTimeUtc_Path_DoesNotExist ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "SetCreationTimeUtcFileNotFoundException1";
                        DeleteFile (path);
-                       
-                       File.SetCreationTimeUtc (path, new DateTime (2000, 12, 12, 11, 59, 59));
+
+                       try {
+                               File.SetCreationTimeUtc (path, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (FileNotFoundException ex) {
+                               Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
+                               Assert.AreEqual (path, ex.FileName, "#3");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                       }
                }
 
 //             [Test]
@@ -1142,7 +2003,7 @@ namespace MonoTests.System.IO
 //                     string path = TempFolder + Path.DirectorySeparatorChar + "SetCreationTimeUtcArgumentOutOfRangeException1";
 //                     DeleteFile (path);
 //                     FileStream stream = null;
-//                     try {                           
+//                     try {
 //                             stream = File.Create (path);
 //                             stream.Close ();
 //                             File.SetCreationTimeUtc (path, new DateTime (1000, 12, 12, 11, 59, 59));
@@ -1154,15 +2015,25 @@ namespace MonoTests.System.IO
 //             }
 
                [Test]
-               [ExpectedException(typeof (IOException))]
-               public void SetCreationTimeUtcIOException1 ()
+               [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM
+               public void SetCreationTimeUtc_FileLock ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "SetCreationTimeUtcIOException1";
                        DeleteFile (path);
                        FileStream stream = null;
                        try {
                                stream = File.Create (path);
-                               File.SetCreationTimeUtc (path, new DateTime (1000, 12, 12, 11, 59, 59));
+                               try {
+                                       File.SetCreationTimeUtc (path, new DateTime (1000, 12, 12, 11, 59, 59));
+                                       Assert.Fail ("#1");
+                               } catch (IOException ex) {
+                                       // The process cannot access the file "..."
+                                       // because it is being used by another process
+                                       Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
+                               }
                        } finally {
                                if (stream != null)
                                        stream.Close ();
@@ -1173,43 +2044,88 @@ namespace MonoTests.System.IO
                // SetLastAccessTime and SetLastAccessTimeUtc exceptions
 
                [Test]
-               [ExpectedException(typeof (ArgumentNullException))]
-               public void SetLastAccessTimeArgumentNullException1 ()
+               [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM
+               public void SetLastAccessTime_Path_Null ()
                {
-                       File.SetLastAccessTime (null as string, new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetLastAccessTime (null as string, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void SetLastAccessTimeArgumenException1 ()
+               [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM
+               public void SetLastAccessTime_Path_Empty ()
                {
-                       File.SetLastAccessTime ("", new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetLastAccessTime (string.Empty, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void SetLastAccessTimeArgumenException2 ()
+               [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM
+               public void SetLastAccessTime_Path_Whitespace ()
                {
-                       File.SetLastAccessTime ("     ", new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetLastAccessTime ("     ", new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               [Category("ValueAdd")]
-               // On Unix there are no invalid path chars.
-               public void SetLastAccessTimeArgumenException3 ()
+               [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM
+               public void SetLastAccessTime_Path_InvalidPathChars ()
                {
-                       File.SetLastAccessTime (Path.InvalidPathChars [1].ToString (), new DateTime (2000, 12, 12, 11, 59, 59));
+                       // On Unix there are no invalid path chars.
+                       if (Path.InvalidPathChars.Length > 1) {
+                               try {
+                                       File.SetLastAccessTime (Path.InvalidPathChars [1].ToString (),
+                                               new DateTime (2000, 12, 12, 11, 59, 59));
+                                       Assert.Fail ("#1");
+                               } catch (ArgumentException ex) {
+                                       // Illegal characters in path
+                                       Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsNull (ex.ParamName, "#5");
+                               }
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (FileNotFoundException))]
-               public void SetLastAccessTimeFileNotFoundException1 ()
+               [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM
+               public void SetLastAccessTime_Path_DoesNotExist ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "SetLastAccessTimeFileNotFoundException1";
                        DeleteFile (path);
-                       
-                       File.SetLastAccessTime (path, new DateTime (2000, 12, 12, 11, 59, 59));
+
+                       try {
+                               File.SetLastAccessTime (path, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (FileNotFoundException ex) {
+                               Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
+                               Assert.AreEqual (path, ex.FileName, "#3");
+                               Assert.IsNull (ex.InnerException, "#4");
+                               Assert.IsNotNull (ex.Message, "#5");
+                       }
                }
 
 //             [Test]
@@ -1231,15 +2147,25 @@ namespace MonoTests.System.IO
 //             }
 
                [Test]
-               [ExpectedException(typeof (IOException))]
-               public void SetLastAccessTimeIOException1 ()
+               [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM
+               public void SetLastAccessTime_FileLock ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "LastAccessIOException1";
                        DeleteFile (path);
                        FileStream stream = null;
                        try {
                                stream = File.Create (path);
-                               File.SetLastAccessTime (path, new DateTime (1000, 12, 12, 11, 59, 59));
+                               try {
+                                       File.SetLastAccessTime (path, new DateTime (1000, 12, 12, 11, 59, 59));
+                                       Assert.Fail ("#1");
+                               } catch (IOException ex) {
+                                       // The process cannot access the file "..."
+                                       // because it is being used by another process
+                                       Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
+                               }
                        } finally {
                                if (stream != null)
                                        stream.Close ();
@@ -1248,43 +2174,88 @@ namespace MonoTests.System.IO
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentNullException))]
-               public void SetLastAccessTimeUtcArgumentNullException1 ()
+               [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM
+               public void SetLastAccessTimeUtc_Path_Null ()
                {
-                       File.SetLastAccessTimeUtc (null as string, new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetLastAccessTimeUtc (null as string, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void SetCLastAccessTimeUtcArgumenException1 ()
+               [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM
+               public void SetCLastAccessTimeUtc_Path_Empty ()
                {
-                       File.SetLastAccessTimeUtc ("", new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetLastAccessTimeUtc (string.Empty, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void SetLastAccessTimeUtcArgumenException2 ()
+               [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM
+               public void SetLastAccessTimeUtc_Path_Whitespace ()
                {
-                       File.SetLastAccessTimeUtc ("     ", new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetLastAccessTimeUtc ("     ", new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               [Category("ValueAdd")]
-               // On Unix there are no invalid path chars.
-               public void SetLastAccessTimeUtcArgumenException3 ()
+               [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM
+               public void SetLastAccessTimeUtc_Path_InvalidPathChars ()
                {
-                       File.SetLastAccessTimeUtc (Path.InvalidPathChars [1].ToString (), new DateTime (2000, 12, 12, 11, 59, 59));
+                       // On Unix there are no invalid path chars.
+                       if (Path.InvalidPathChars.Length > 1) {
+                               try {
+                                       File.SetLastAccessTimeUtc (Path.InvalidPathChars [1].ToString (),
+                                               new DateTime (2000, 12, 12, 11, 59, 59));
+                                       Assert.Fail ("#1");
+                               } catch (ArgumentException ex) {
+                                       // Illegal characters in path
+                                       Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsNull (ex.ParamName, "#5");
+                               }
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (FileNotFoundException))]
-               public void SetLastAccessTimeUtcFileNotFoundException1 ()
+               [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM
+               public void SetLastAccessTimeUtc_Path_DoesNotExist ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "SetLastAccessTimeUtcFileNotFoundException1";
                        DeleteFile (path);
-                       
-                       File.SetLastAccessTimeUtc (path, new DateTime (2000, 12, 12, 11, 59, 59));
+
+                       try {
+                               File.SetLastAccessTimeUtc (path, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (FileNotFoundException ex) {
+                               Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
+                               Assert.AreEqual (path, ex.FileName, "#3");
+                               Assert.IsNull (ex.InnerException, "#4");
+                               Assert.IsNotNull (ex.Message, "#5");
+                       }
                }
 
 //             [Test]
@@ -1306,15 +2277,25 @@ namespace MonoTests.System.IO
 //             }
 
                [Test]
-               [ExpectedException(typeof (IOException))]
-               public void SetLastAccessTimeUtcIOException1 ()
+               [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM
+               public void SetLastAccessTimeUtc_FileLock ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "SetLastAccessTimeUtcIOException1";
                        DeleteFile (path);
                        FileStream stream = null;
                        try {
                                stream = File.Create (path);
-                               File.SetLastAccessTimeUtc (path, new DateTime (1000, 12, 12, 11, 59, 59));
+                               try {
+                                       File.SetLastAccessTimeUtc (path, new DateTime (1000, 12, 12, 11, 59, 59));
+                                       Assert.Fail ("#1");
+                               } catch (IOException ex) {
+                                       // The process cannot access the file "..."
+                                       // because it is being used by another process
+                                       Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
+                               }
                        } finally {
                                if (stream != null)
                                        stream.Close ();
@@ -1325,43 +2306,83 @@ namespace MonoTests.System.IO
                // SetLastWriteTime and SetLastWriteTimeUtc exceptions
 
                [Test]
-               [ExpectedException(typeof (ArgumentNullException))]
-               public void SetLastWriteTimeArgumentNullException1 ()
+               public void SetLastWriteTime_Path_Null ()
                {
-                       File.SetLastWriteTime (null as string, new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetLastWriteTime (null as string, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void SetLastWriteTimeArgumenException1 ()
+               public void SetLastWriteTime_Path_Empty ()
                {
-                       File.SetLastWriteTime ("", new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetLastWriteTime (string.Empty, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void SetLastWriteTimeArgumenException2 ()
+               public void SetLastWriteTime_Path_Whitespace ()
                {
-                       File.SetLastWriteTime ("     ", new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetLastWriteTime ("     ", new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               [Category("ValueAdd")]
-               // On Unix there are no invalid path chars.
-               public void SetLastWriteTimeArgumenException3 ()
+               public void SetLastWriteTime_Path_InvalidPathChars ()
                {
-                       File.SetLastWriteTime (Path.InvalidPathChars [1].ToString (), new DateTime (2000, 12, 12, 11, 59, 59));
+                       // On Unix there are no invalid path chars.
+                       if (Path.InvalidPathChars.Length > 1) {
+                               try {
+                                       File.SetLastWriteTime (Path.InvalidPathChars [1].ToString (),
+                                               new DateTime (2000, 12, 12, 11, 59, 59));
+                                       Assert.Fail ("#1");
+                               } catch (ArgumentException ex) {
+                                       // Illegal characters in path
+                                       Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsNull (ex.ParamName, "#5");
+                               }
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (FileNotFoundException))]
-               public void SetLastWriteTimeFileNotFoundException1 ()
+               public void SetLastWriteTime_Path_DoesNotExist ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "SetLastWriteTimeFileNotFoundException1";
                        DeleteFile (path);
-                       
-                       File.SetLastWriteTime (path, new DateTime (2000, 12, 12, 11, 59, 59));
+
+                       try {
+                               File.SetLastWriteTime (path, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (FileNotFoundException ex) {
+                               Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
+                               Assert.AreEqual (path, ex.FileName, "#3");
+                               Assert.IsNull (ex.InnerException, "#4");
+                               Assert.IsNotNull (ex.Message, "#5");
+                       }
                }
 
 //             [Test]
@@ -1383,15 +2404,24 @@ namespace MonoTests.System.IO
 //             }
 
                [Test]
-               [ExpectedException(typeof (IOException))]
-               public void SetLastWriteTimeIOException1 ()
+               public void SetLastWriteTime_FileLock ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "LastWriteTimeIOException1";
                        DeleteFile (path);
                        FileStream stream = null;
                        try {
                                stream = File.Create (path);
-                               File.SetLastWriteTime (path, new DateTime (1000, 12, 12, 11, 59, 59));
+                               try {
+                                       File.SetLastWriteTime (path, new DateTime (1000, 12, 12, 11, 59, 59));
+                                       Assert.Fail ("#1");
+                               } catch (IOException ex) {
+                                       // The process cannot access the file '...'
+                                       // because it is being used by another process
+                                       Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
+                               }
                        } finally {
                                if (stream != null)
                                        stream.Close ();
@@ -1400,43 +2430,83 @@ namespace MonoTests.System.IO
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentNullException))]
-               public void SetLastWriteTimeUtcArgumentNullException1 ()
+               public void SetLastWriteTimeUtc_Path_Null ()
                {
-                       File.SetLastWriteTimeUtc (null as string, new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetLastWriteTimeUtc (null as string, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException ex) {
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.AreEqual ("path", ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void SetCLastWriteTimeUtcArgumenException1 ()
+               public void SetLastWriteTimeUtc_Path_Empty ()
                {
-                       File.SetLastWriteTimeUtc ("", new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetLastWriteTimeUtc (string.Empty, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // Empty file name is not legal
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               public void SetLastWriteTimeUtcArgumenException2 ()
+               public void SetLastWriteTimeUtc_Path_Whitespace ()
                {
-                       File.SetLastWriteTimeUtc ("     ", new DateTime (2000, 12, 12, 11, 59, 59));
+                       try {
+                               File.SetLastWriteTimeUtc ("     ", new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+                               // The path is not of a legal form
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (ArgumentException))]
-               [Category("ValueAdd")]
-               // On Unix there are no invalid path chars.
-               public void SetLastWriteTimeUtcArgumenException3 ()
+               public void SetLastWriteTimeUtc_Path_InvalidPathChars ()
                {
-                       File.SetLastWriteTimeUtc (Path.InvalidPathChars [1].ToString (), new DateTime (2000, 12, 12, 11, 59, 59));
+                       // On Unix there are no invalid path chars.
+                       if (Path.InvalidPathChars.Length > 1) {
+                               try {
+                                       File.SetLastWriteTimeUtc (Path.InvalidPathChars [1].ToString (),
+                                               new DateTime (2000, 12, 12, 11, 59, 59));
+                                       Assert.Fail ("#1");
+                               } catch (ArgumentException ex) {
+                                       // Illegal characters in path
+                                       Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsNull (ex.ParamName, "#5");
+                               }
+                       }
                }
 
                [Test]
-               [ExpectedException(typeof (FileNotFoundException))]
-               public void SetLastWriteTimeUtcFileNotFoundException1 ()
+               public void SetLastWriteTimeUtc_Path_DoesNotExist ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "SetLastWriteTimeUtcFileNotFoundException1";
                        DeleteFile (path);
-                       
-                       File.SetLastAccessTimeUtc (path, new DateTime (2000, 12, 12, 11, 59, 59));
+
+                       try {
+                               File.SetLastWriteTimeUtc (path, new DateTime (2000, 12, 12, 11, 59, 59));
+                               Assert.Fail ("#1");
+                       } catch (FileNotFoundException ex) {
+                               Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
+                               Assert.AreEqual (path, ex.FileName, "#3");
+                               Assert.IsNull (ex.InnerException, "#4");
+                               Assert.IsNotNull (ex.Message, "#5");
+                       }
                }
 
 //             [Test]
@@ -1456,28 +2526,129 @@ namespace MonoTests.System.IO
 //                             DeleteFile (path);
 //                     }
 //             }
-//
+
                [Test]
-               [ExpectedException(typeof (IOException))]
-               public void SetLastWriteTimeUtcIOException1 ()
+               public void SetLastWriteTimeUtc_FileLock ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "SetLastWriteTimeUtcIOException1";
                        DeleteFile (path);
                        FileStream stream = null;
                        try {
                                stream = File.Create (path);
-                               File.SetLastAccessTimeUtc (path, new DateTime (1000, 12, 12, 11, 59, 59));
+                               try {
+                                       File.SetLastWriteTimeUtc (path, new DateTime (1000, 12, 12, 11, 59, 59));
+                                       Assert.Fail ("#1");
+                               } catch (IOException ex) {
+                                       // The process cannot access the file '...'
+                                       // because it is being used by another process
+                                       Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
+                                       Assert.IsNull (ex.InnerException, "#3");
+                                       Assert.IsNotNull (ex.Message, "#4");
+                                       Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
+                               }
                        } finally {
                                if (stream != null)
                                        stream.Close ();
                                DeleteFile (path);
                        }
                }
+               
+               [Test]
+               public void OpenAppend ()
+               {
+                       string fn = Path.GetTempFileName ();
+                       using (FileStream s = File.Open (fn, FileMode.Append)) {
+                       }
+                       DeleteFile (fn);
+               }
+
+#if NET_2_0
+               [Test]
+               public void ReadWriteAllText ()
+               {
+                       // The MSDN docs said something about
+                       // not including a final new line. it looks
+                       // like that was not true. I'm not sure what
+                       // that was talking about
+                       read_all (string.Empty);
+                       read_all ("\r");
+                       read_all ("\n");
+                       read_all ("\r\n");
+                       read_all ("a\r");
+                       read_all ("a\n");
+                       read_all ("a\r\n");
+                       read_all ("a\ra");
+                       read_all ("a\na");
+                       read_all ("a\r\na");
+                       read_all ("a");
+                       read_all ("\r\r");
+                       read_all ("\n\n");
+                       read_all ("\r\n\r\n");
+               }
+
+               [Test]
+               public void ReplaceTest ()
+               {
+                       string tmp = Path.Combine (TempFolder, "ReplaceTest");
+                       Directory.CreateDirectory (tmp);
+                       string origFile = Path.Combine (tmp, "origFile");
+                       string replaceFile = Path.Combine (tmp, "replaceFile");
+                       string backupFile = Path.Combine (tmp, "backupFile");
+
+                       using (StreamWriter sw = File.CreateText (origFile)) {
+                               sw.WriteLine ("origFile");
+                       }
+                       using (StreamWriter sw = File.CreateText (replaceFile)) {
+                               sw.WriteLine ("replaceFile");
+                       }
+                       using (StreamWriter sw = File.CreateText (backupFile)) {
+                               sw.WriteLine ("backupFile");
+                       }
+
+                       File.Replace (origFile, replaceFile, backupFile);
+                       Assert.IsFalse (File.Exists (origFile), "#1");
+                       using (StreamReader sr = File.OpenText (replaceFile)) {
+                               string txt = sr.ReadLine ();
+                               Assert.AreEqual ("origFile", txt, "#2");
+                       }
+                       using (StreamReader sr = File.OpenText (backupFile)) {
+                               string txt = sr.ReadLine ();
+                               Assert.AreEqual ("replaceFile", txt, "#3");
+                       }
+               }
+#endif
+
+               static bool RunningOnUnix {
+                       get {
+                               int p = (int) Environment.OSVersion.Platform;
+                               return ((p == 4) || (p == 128) || (p == 6));
+                       }
+               }
 
-               private void DeleteFile (string path)
+               void DeleteFile (string path)
                {
                        if (File.Exists (path))
                                File.Delete (path);
                }
+
+               void DeleteDirectory (string path)
+               {
+                       if (Directory.Exists (path))
+                               Directory.Delete (path, true);
+               }
+
+#if NET_2_0
+               void read_all (string s)
+               {
+                       string f = Path.GetTempFileName ();
+                       try {
+                               File.WriteAllText (f, s);
+                               string r = File.ReadAllText (f);
+                               Assert.AreEqual (s, r);
+                       } finally {
+                               DeleteFile (f);
+                       }
+               }
+#endif
        }
 }