2004-06-16 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Mon, 21 Jun 2004 13:42:39 +0000 (13:42 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Mon, 21 Jun 2004 13:42:39 +0000 (13:42 -0000)
* DirectoryInfoTest.cs,
  DirectoryTest.cs,
  FileStreamTest.cs,
  FileSystemInfoTest.cs:
  Replace all '/' in path with Path.DirectorySeparatorChar.

svn path=/trunk/mcs/; revision=30037

mcs/class/corlib/Test/System.IO/ChangeLog
mcs/class/corlib/Test/System.IO/DirectoryInfoTest.cs
mcs/class/corlib/Test/System.IO/DirectoryTest.cs
mcs/class/corlib/Test/System.IO/FileStreamTest.cs
mcs/class/corlib/Test/System.IO/FileSystemInfoTest.cs

index 9d6f00d13940963614b391c66c24c8ffe6b08f37..2ed23869cf21df58b81ab0f90ef7ece9fa790346 100644 (file)
@@ -1,3 +1,11 @@
+2004-06-16  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DirectoryInfoTest.cs,
+         DirectoryTest.cs,
+         FileStreamTest.cs,
+         FileSystemInfoTest.cs:
+         Replace all '/' in path with Path.DirectorySeparatorChar.
+
 2004-06-08  Duncan Mak  <duncan@ximian.com>
 
        * DirectoryTest.cs (GetParentOfRootDirectory): Add test for
index ad50fa14263f7cf3c280a7a3a75c78287f2ecbf7..48024424c31a59dcf9174528c1ced908a381c725 100644 (file)
@@ -14,6 +14,8 @@ namespace MonoTests.System.IO
        {\r
                string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");\r
 \r
+               static readonly char DSC = Path.DirectorySeparatorChar;\r
+\r
                [SetUp]\r
                protected void SetUp() {\r
                        if (Directory.Exists (TempFolder))\r
@@ -30,7 +32,7 @@ namespace MonoTests.System.IO
                [Test]\r
                public void Ctr ()\r
                {\r
-                       string path = TempFolder + "/DIT.Ctr.Test";\r
+                       string path = TempFolder + DSC + "DIT.Ctr.Test";\r
                        DeleteDir (path);\r
                \r
                        FileInfo info = new FileInfo (path);\r
@@ -75,7 +77,7 @@ namespace MonoTests.System.IO
                [Test]\r
                public void Exists ()\r
                {\r
-               string path = TempFolder + "/DIT.Exists.Test";\r
+               string path = TempFolder + DSC + "DIT.Exists.Test";\r
                DeleteDir (path);\r
             \r
                try {\r
@@ -94,7 +96,7 @@ namespace MonoTests.System.IO
                [Test]\r
                public void Name ()\r
                {\r
-                       string path = TempFolder + "/DIT.Name.Test";\r
+                       string path = TempFolder + DSC + "DIT.Name.Test";\r
                        DeleteDir (path);\r
                        \r
                        try {\r
@@ -113,7 +115,7 @@ namespace MonoTests.System.IO
                [Test]\r
                public void Parent ()\r
                {\r
-                       string path = TempFolder + "/DIT.Parent.Test";\r
+                       string path = TempFolder + DSC + "DIT.Parent.Test";\r
                        DeleteDir (path);\r
                        \r
                        try {\r
@@ -131,7 +133,7 @@ namespace MonoTests.System.IO
                [Test]\r
                public void Create ()\r
                {\r
-               string path = TempFolder + "/DIT.Create.Test";\r
+               string path = TempFolder + DSC + "DIT.Create.Test";\r
                DeleteDir (path);\r
             \r
                try {\r
@@ -163,7 +165,7 @@ namespace MonoTests.System.IO
                [Test]\r
                public void Delete1 ()\r
                {\r
-               string path = TempFolder + "/DIT.Delete1.Test";\r
+               string path = TempFolder + DSC + "DIT.Delete1.Test";\r
                DeleteDir (path);\r
                        \r
                        try {\r
@@ -184,12 +186,12 @@ namespace MonoTests.System.IO
                [Test]\r
                public void Delete2 ()\r
                {\r
-               string path = TempFolder + "/DIT.Delete2.Test";\r
+               string path = TempFolder + DSC + "DIT.Delete2.Test";\r
                DeleteDir (path);\r
                        \r
                        try {\r
                                Directory.CreateDirectory (path);\r
-                               File.Create (path + "/test").Close ();\r
+                               File.Create (path + DSC + "test").Close ();\r
                                DirectoryInfo info = new DirectoryInfo (path);\r
                                AssertEquals ("test#01", true, info.Exists);\r
                                \r
@@ -207,12 +209,12 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (IOException))]\r
                public void DeleteIOException1 ()\r
                {\r
-               string path = TempFolder + "/DIT.DeleteIOException1.Test";\r
+               string path = TempFolder + DSC + "DIT.DeleteIOException1.Test";\r
                DeleteDir (path);                       \r
                        \r
                        try {\r
                                Directory.CreateDirectory (path);\r
-                               File.Create (path + "/test").Close ();\r
+                               File.Create (path + DSC + "test").Close ();\r
                                DirectoryInfo info = new DirectoryInfo (path);\r
                                info.Delete ();\r
                        } finally {\r
@@ -224,12 +226,12 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (IOException))]\r
                public void DeleteIOException2 ()\r
                {\r
-               string path = TempFolder + "/DIT.DeleteIOException2.Test";\r
+               string path = TempFolder + DSC + "DIT.DeleteIOException2.Test";\r
                DeleteDir (path);                       \r
                        \r
                        try {\r
                                Directory.CreateDirectory (path);\r
-                               File.Create (path + "/test").Close ();\r
+                               File.Create (path + DSC + "test").Close ();\r
                                DirectoryInfo info = new DirectoryInfo (path);\r
                                info.Delete (false);\r
                        } finally {\r
@@ -240,18 +242,18 @@ namespace MonoTests.System.IO
                [Test]\r
                public void GetDirectories1 ()\r
                {\r
-                       string path = TempFolder + "/DIT.GetDirectories1.Test";\r
+                       string path = TempFolder + DSC + "DIT.GetDirectories1.Test";\r
                        \r
                        try {\r
                                DirectoryInfo info = Directory.CreateDirectory (path);\r
                                AssertEquals ("test#01", 0, info.GetDirectories ().Length);\r
                                \r
-                               Directory.CreateDirectory (path + "/" + "1");\r
-                               Directory.CreateDirectory (path + "/" + "2");                           \r
-                               File.Create (path + "/" + "filetest").Close ();\r
+                               Directory.CreateDirectory (path + DSC + "1");\r
+                               Directory.CreateDirectory (path + DSC + "2");                           \r
+                               File.Create (path + DSC + "filetest").Close ();\r
                                AssertEquals ("test#02", 2, info.GetDirectories ().Length);\r
                                \r
-                               Directory.Delete (path + "/" + 2);\r
+                               Directory.Delete (path + DSC + 2);\r
                                AssertEquals ("test#02", 1, info.GetDirectories ().Length);                             \r
                                \r
                        } finally {\r
@@ -262,17 +264,17 @@ namespace MonoTests.System.IO
                [Test]\r
                public void GetDirectories2 ()\r
                {\r
-                       string path = TempFolder + "/DIT.GetDirectories2.Test";\r
+                       string path = TempFolder + DSC + "DIT.GetDirectories2.Test";\r
                        \r
                        try {\r
                                DirectoryInfo info = Directory.CreateDirectory (path);\r
                                AssertEquals ("test#01", 0, info.GetDirectories ("*").Length);\r
                                \r
-                               Directory.CreateDirectory (path + "/" + "test120");\r
-                               Directory.CreateDirectory (path + "/" + "test210");\r
-                               Directory.CreateDirectory (path + "/" + "atest330");\r
-                               Directory.CreateDirectory (path + "/" + "test220");\r
-                               File.Create (path + "/" + "filetest").Close ();\r
+                               Directory.CreateDirectory (path + DSC + "test120");\r
+                               Directory.CreateDirectory (path + DSC + "test210");\r
+                               Directory.CreateDirectory (path + DSC + "atest330");\r
+                               Directory.CreateDirectory (path + DSC + "test220");\r
+                               File.Create (path + DSC + "filetest").Close ();\r
                                \r
                                AssertEquals ("test#02", 4, info.GetDirectories ("*").Length);\r
                                AssertEquals ("test#03", 3, info.GetDirectories ("test*").Length);\r
@@ -291,7 +293,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (DirectoryNotFoundException))]               \r
                public void GetDirectoriesDirectoryNotFoundException1 ()\r
                {\r
-               string path = TempFolder + "/DIT.GetDirectoriesDirectoryNotFoundException1.Test";\r
+               string path = TempFolder + DSC + "DIT.GetDirectoriesDirectoryNotFoundException1.Test";\r
                DeleteDir (path);\r
                        \r
                        try {\r
@@ -306,7 +308,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (DirectoryNotFoundException))]               \r
                public void GetDirectoriesDirectoryNotFoundException2 ()\r
                {\r
-               string path = TempFolder + "/DIT.GetDirectoriesDirectoryNotFoundException2.Test";\r
+               string path = TempFolder + DSC + "DIT.GetDirectoriesDirectoryNotFoundException2.Test";\r
                DeleteDir (path);\r
                        \r
                        try {\r
@@ -321,7 +323,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (ArgumentNullException))]\r
                public void GetDirectoriesArgumentNullException ()\r
                {\r
-               string path = TempFolder + "/DIT.GetDirectoriesArgumentNullException.Test";\r
+               string path = TempFolder + DSC + "DIT.GetDirectoriesArgumentNullException.Test";\r
                DeleteDir (path);\r
                        \r
                        try {\r
@@ -335,15 +337,15 @@ namespace MonoTests.System.IO
                [Test]\r
                public void GetFiles1 ()\r
                {\r
-               string path = TempFolder + "/DIT.GetFiles1.Test";\r
+               string path = TempFolder + DSC + "DIT.GetFiles1.Test";\r
                DeleteDir (path);\r
                        \r
                        try {\r
                                DirectoryInfo info = Directory.CreateDirectory (path);\r
                                AssertEquals ("test#01", 0, info.GetFiles ().Length);\r
-                               File.Create (path + "/" + "file1").Close ();\r
-                               File.Create (path + "/" + "file2").Close ();\r
-                               Directory.CreateDirectory (path + "/" + "directory1");\r
+                               File.Create (path + DSC + "file1").Close ();\r
+                               File.Create (path + DSC + "file2").Close ();\r
+                               Directory.CreateDirectory (path + DSC + "directory1");\r
                                AssertEquals ("test#02", 2, info.GetFiles ().Length);\r
                                                        \r
                        } finally {\r
@@ -354,19 +356,19 @@ namespace MonoTests.System.IO
                [Test]\r
                public void GetFiles2()\r
                {\r
-               string path = TempFolder + "/DIT.GetFiles2.Test";\r
+               string path = TempFolder + DSC + "DIT.GetFiles2.Test";\r
                DeleteDir (path);\r
                        \r
                        try {\r
                                DirectoryInfo info = Directory.CreateDirectory (path);\r
                                AssertEquals ("test#01", 0, info.GetFiles ("*").Length);\r
-                               File.Create (path + "/" + "file120file").Close ();\r
-                               File.Create (path + "/" + "file220file").Close ();\r
-                               File.Create (path + "/" + "afile330file").Close ();\r
-                               File.Create (path + "/" + "test.abc").Close ();\r
-                               File.Create (path + "/" + "test.abcd").Close ();\r
-                               File.Create (path + "/" + "test.abcdef").Close ();                              \r
-                               Directory.CreateDirectory (path + "/" + "dir");\r
+                               File.Create (path + DSC + "file120file").Close ();\r
+                               File.Create (path + DSC + "file220file").Close ();\r
+                               File.Create (path + DSC + "afile330file").Close ();\r
+                               File.Create (path + DSC + "test.abc").Close ();\r
+                               File.Create (path + DSC + "test.abcd").Close ();\r
+                               File.Create (path + DSC + "test.abcdef").Close ();                              \r
+                               Directory.CreateDirectory (path + DSC + "dir");\r
                                \r
                                AssertEquals ("test#02", 6, info.GetFiles ("*").Length);\r
                                AssertEquals ("test#03", 2, info.GetFiles ("file*file").Length);\r
@@ -383,7 +385,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (DirectoryNotFoundException))]\r
                public void GetFilesDirectoryNotFoundException1 ()\r
                {\r
-                       string path = TempFolder + "/DIT.GetFilesDirectoryNotFoundException1.Test";\r
+                       string path = TempFolder + DSC + "DIT.GetFilesDirectoryNotFoundException1.Test";\r
                        DeleteDir (path);\r
                        \r
                        try {\r
@@ -399,7 +401,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (DirectoryNotFoundException))]\r
                public void GetFilesDirectoryNotFoundException2 ()\r
                {\r
-                       string path = TempFolder + "/DIT.GetFilesDirectoryNotFoundException2.Test";\r
+                       string path = TempFolder + DSC + "DIT.GetFilesDirectoryNotFoundException2.Test";\r
                        DeleteDir (path);\r
                        \r
                        try {\r
@@ -415,7 +417,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (ArgumentNullException))]\r
                public void GetFilesArgumentNullException ()\r
                {\r
-                       string path = TempFolder + "/DIT.GetFilesArgumentNullException.Test";\r
+                       string path = TempFolder + DSC + "DIT.GetFilesArgumentNullException.Test";\r
                        DeleteDir (path);\r
                        \r
                        try {\r
@@ -429,8 +431,8 @@ namespace MonoTests.System.IO
                [Test]\r
                public void MoveTo ()\r
                {\r
-                       string path1 = TempFolder + "/DIT.MoveTo.Soucre.Test";\r
-                       string path2 = TempFolder + "/DIT.MoveTo.Dest.Test";\r
+                       string path1 = TempFolder + DSC + "DIT.MoveTo.Soucre.Test";\r
+                       string path2 = TempFolder + DSC + "DIT.MoveTo.Dest.Test";\r
                        DeleteDir (path1);\r
                        DeleteDir (path2);\r
                        \r
@@ -460,7 +462,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (ArgumentNullException))]\r
                public void MoveToArgumentNullException ()\r
                {\r
-                       string path = TempFolder + "/DIT.MoveToArgumentNullException.Test";\r
+                       string path = TempFolder + DSC + "DIT.MoveToArgumentNullException.Test";\r
                        DeleteDir (path);\r
                        \r
                        try {\r
@@ -476,7 +478,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (IOException))]\r
                public void MoveToIOException1 ()\r
                {\r
-                       string path = TempFolder + "/DIT.MoveToIOException1.Test";\r
+                       string path = TempFolder + DSC + "DIT.MoveToIOException1.Test";\r
                        DeleteDir (path);\r
                        \r
                        try {\r
@@ -491,7 +493,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (ArgumentException))]\r
                public void MoveToArgumentException1 ()\r
                {\r
-                       string path = TempFolder + "/DIT.MoveToArgumentException1.Test";\r
+                       string path = TempFolder + DSC + "DIT.MoveToArgumentException1.Test";\r
                        DeleteDir (path);\r
                        \r
                        try {\r
@@ -506,7 +508,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (ArgumentException))]\r
                public void MoveToArgumentException2 ()\r
                {\r
-                       string path = TempFolder + "/DIT.MoveToArgumentException2.Test";\r
+                       string path = TempFolder + DSC + "DIT.MoveToArgumentException2.Test";\r
                        DeleteDir (path);\r
                        \r
                        try {\r
@@ -521,7 +523,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (ArgumentException))]\r
                public void MoveToArgumentException3 ()\r
                {\r
-                       string path = TempFolder + "/DIT.MoveToArgumentException3.Test";\r
+                       string path = TempFolder + DSC + "DIT.MoveToArgumentException3.Test";\r
                        DeleteDir (path);\r
                        \r
                        try {\r
@@ -536,7 +538,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (IOException))]\r
                public void MoveToIOException2 ()\r
                {\r
-                       string path = TempFolder + "/DIT.MoveToIOException2.Test";\r
+                       string path = TempFolder + DSC + "DIT.MoveToIOException2.Test";\r
                        DeleteDir (path);\r
                        \r
                        try {\r
index 512e36cc739178fbce881e629a908cc24ec569d4..5b168e315486b3d1258c6a3a4507c7d9ed3f7e10 100755 (executable)
@@ -22,7 +22,8 @@ namespace MonoTests.System.IO {
 public class DirectoryTest : Assertion {\r
        \r
        string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");\r
-       \r
+       static readonly char DSC = Path.DirectorySeparatorChar;\r
+\r
        [SetUp]\r
        public void SetUp ()\r
        {\r
@@ -41,7 +42,7 @@ public class DirectoryTest : Assertion {
        [Test]\r
        public void CreateDirectory ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test.1";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test.1";\r
                DeleteDirectory (path);\r
                try {\r
                        DirectoryInfo info = Directory.CreateDirectory (path);\r
@@ -88,7 +89,7 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(ArgumentException))]\r
        public void CreateDirectoryArgumentException3 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test";\r
                DeleteDirectory (path);\r
                try {\r
                        path += Path.InvalidPathChars [0];\r
@@ -102,30 +103,30 @@ public class DirectoryTest : Assertion {
        [Test]\r
        public void Delete ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test.Delete.1";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test.Delete.1";\r
                DeleteDirectory (path);\r
                try {\r
                        Directory.CreateDirectory (path);\r
                        AssertEquals ("test#01", true, Directory.Exists (path));\r
                \r
-                       Directory.CreateDirectory (path + "/DirectoryTest.Test.Delete.1.2");\r
-                       AssertEquals ("test#02", true, Directory.Exists (path + "/DirectoryTest.Test.Delete.1.2"));\r
+                       Directory.CreateDirectory (path + DSC + "DirectoryTest.Test.Delete.1.2");\r
+                       AssertEquals ("test#02", true, Directory.Exists (path + DSC + "DirectoryTest.Test.Delete.1.2"));\r
                \r
-                       Directory.Delete (path + "/DirectoryTest.Test.Delete.1.2");\r
-                       AssertEquals ("test#03", false, Directory.Exists (path + "/DirectoryTest.Test.Delete.1.2"));\r
+                       Directory.Delete (path + DSC + "DirectoryTest.Test.Delete.1.2");\r
+                       AssertEquals ("test#03", false, Directory.Exists (path + DSC + "DirectoryTest.Test.Delete.1.2"));\r
                        AssertEquals ("test#04", true, Directory.Exists (path));\r
                \r
                        Directory.Delete (path);\r
-                       AssertEquals ("test#05", false, Directory.Exists (path + "/DirectoryTest.Test.Delete.1.2"));\r
+                       AssertEquals ("test#05", false, Directory.Exists (path + DSC + "DirectoryTest.Test.Delete.1.2"));\r
                        AssertEquals ("test#06", false, Directory.Exists (path));               \r
        \r
                        Directory.CreateDirectory (path);\r
-                       Directory.CreateDirectory (path + "/DirectoryTest.Test.Delete.1.2");\r
-                       AssertEquals ("test#07", true, Directory.Exists (path + "/DirectoryTest.Test.Delete.1.2"));\r
+                       Directory.CreateDirectory (path + DSC + "DirectoryTest.Test.Delete.1.2");\r
+                       AssertEquals ("test#07", true, Directory.Exists (path + DSC + "DirectoryTest.Test.Delete.1.2"));\r
                        AssertEquals ("test#08", true, Directory.Exists (path));\r
                \r
                        Directory.Delete (path, true);\r
-                       AssertEquals ("test#09", false, Directory.Exists (path + "/DirectoryTest.Test.Delete.1.2"));\r
+                       AssertEquals ("test#09", false, Directory.Exists (path + DSC + "DirectoryTest.Test.Delete.1.2"));\r
                        AssertEquals ("test#10", false, Directory.Exists (path));\r
                } finally {\r
                        DeleteDirectory (path);\r
@@ -150,7 +151,7 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(ArgumentException))]\r
        public void DeleteArgumentException3 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test.4";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test.4";\r
                DeleteDirectory (path);\r
                \r
                path += Path.InvalidPathChars [0];\r
@@ -168,7 +169,7 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(DirectoryNotFoundException))]\r
        public void DeleteDirectoryNotFoundException ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test.5";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test.5";\r
                DeleteDirectory (path);\r
                \r
                Directory.Delete (path);                \r
@@ -178,12 +179,12 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(IOException))]\r
        public void DeleteArgumentException4 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test.6";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test.6";\r
                DeleteDirectory (path);\r
                FileStream s = null;\r
                Directory.CreateDirectory (path);\r
                try {\r
-                       s = File.Create (path + "/DirectoryTest.Test.6");\r
+                       s = File.Create (path + DSC + "DirectoryTest.Test.6");\r
                        Directory.Delete (path);\r
                } finally {\r
                        if (s != null)\r
@@ -216,7 +217,7 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(IOException))]\r
        public void GetCreationTimeException3 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.GetCreationTime.1";\r
+               string path = TempFolder + DSC + "DirectoryTest.GetCreationTime.1";\r
                DeleteDirectory (path);\r
                try {\r
                        Directory.GetCreationTime (path);\r
@@ -257,7 +258,7 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(IOException))]\r
        public void GetCreationTimeUtcException3 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.GetCreationTimeUtc.1";\r
+               string path = TempFolder + DSC + "DirectoryTest.GetCreationTimeUtc.1";\r
                DeleteDirectory (path);\r
                \r
                try {\r
@@ -299,7 +300,7 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(IOException))]\r
        public void GetLastAccessTimeException3 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.GetLastAccessTime.1";\r
+               string path = TempFolder + DSC + "DirectoryTest.GetLastAccessTime.1";\r
                DeleteDirectory (path);\r
                \r
                try {\r
@@ -341,7 +342,7 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(IOException))]\r
        public void GetLastAccessTimeUtcException3 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.GetLastAccessTimeUtc.1";\r
+               string path = TempFolder + DSC + "DirectoryTest.GetLastAccessTimeUtc.1";\r
                DeleteDirectory (path);\r
                try {\r
                        Directory.GetLastAccessTimeUtc (path);\r
@@ -382,7 +383,7 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(IOException))]\r
        public void GetLastWriteTimeException3 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.GetLastWriteTime.1";\r
+               string path = TempFolder + DSC + "DirectoryTest.GetLastWriteTime.1";\r
                DeleteDirectory (path);\r
                try {\r
                        Directory.GetLastWriteTime (path);\r
@@ -423,7 +424,7 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(IOException))]\r
        public void GetLastWriteTimeUtcException3 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.GetLastWriteTimeUtc.1";\r
+               string path = TempFolder + DSC + "DirectoryTest.GetLastWriteTimeUtc.1";\r
                DeleteDirectory (path);\r
                try {\r
                        Directory.GetLastAccessTimeUtc (path);\r
@@ -450,24 +451,24 @@ public class DirectoryTest : Assertion {
        [Test]\r
        public void Move ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test.9";\r
-               string path2 = TempFolder + "/DirectoryTest.Test.10";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test.9";\r
+               string path2 = TempFolder + DSC + "DirectoryTest.Test.10";\r
                DeleteDirectory (path);\r
                DeleteDirectory (path2);\r
                try {\r
                        Directory.CreateDirectory (path);\r
-                       Directory.CreateDirectory (path + "/" + "dir");\r
-                       AssertEquals ("test#01", true, Directory.Exists (path + "/" + "dir"));\r
+                       Directory.CreateDirectory (path + DSC + "dir");\r
+                       AssertEquals ("test#01", true, Directory.Exists (path + DSC + "dir"));\r
                \r
                        Directory.Move (path, path2);\r
-                       AssertEquals ("test#02", false, Directory.Exists (path + "/" + "dir"));         \r
-                       AssertEquals ("test#03", true, Directory.Exists (path2 + "/" + "dir"));\r
+                       AssertEquals ("test#02", false, Directory.Exists (path + DSC + "dir"));         \r
+                       AssertEquals ("test#03", true, Directory.Exists (path2 + DSC + "dir"));\r
                \r
                } finally {\r
                        DeleteDirectory (path);\r
                        DeleteDirectory (path2);\r
-                       if (Directory.Exists (path2 + "/" + "dir"))\r
-                               Directory.Delete (path2 + "/" + "dir", true);                   \r
+                       if (Directory.Exists (path2 + DSC + "dir"))\r
+                               Directory.Delete (path2 + DSC + "dir", true);                   \r
                }\r
        }\r
        \r
@@ -475,7 +476,7 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(IOException))]\r
        public void MoveException1 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test.8";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test.8";\r
                DeleteDirectory (path);         \r
                try {\r
                        Directory.Move (path, path);            \r
@@ -488,7 +489,7 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(ArgumentException))]\r
        public void MoveException2 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test.11";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test.11";\r
                DeleteDirectory (path);         \r
                try {\r
                        Directory.Move ("", path);              \r
@@ -501,7 +502,7 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(ArgumentException))]\r
        public void MoveException3 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test.12";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test.12";\r
                DeleteDirectory (path);         \r
                try {\r
                        Directory.Move ("             ", path);\r
@@ -514,9 +515,9 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(ArgumentException))]\r
        public void MoveException4 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test.13";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test.13";\r
                path += Path.InvalidPathChars [0];\r
-               string path2 = TempFolder + "/DirectoryTest.Test.13";           \r
+               string path2 = TempFolder + DSC + "DirectoryTest.Test.13";              \r
                DeleteDirectory (path);\r
                DeleteDirectory (path2);\r
                try {\r
@@ -532,7 +533,7 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(DirectoryNotFoundException))]\r
        public void MoveException5 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test.14";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test.14";\r
                DeleteDirectory (path);\r
                try {\r
                        Directory.Move (path, path + "Test.Test");              \r
@@ -546,14 +547,14 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(IOException))]\r
        public void MoveException6 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test.15";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test.15";\r
                DeleteDirectory (path);\r
                try {\r
                        Directory.CreateDirectory (path);               \r
-                       Directory.Move (path, path + "/" + "dir");\r
+                       Directory.Move (path, path + DSC + "dir");\r
                } finally {\r
                        DeleteDirectory (path);\r
-                       DeleteDirectory (path + "/" + "dir");                   \r
+                       DeleteDirectory (path + DSC + "dir");                   \r
                }\r
        }\r
 \r
@@ -561,8 +562,8 @@ public class DirectoryTest : Assertion {
        [ExpectedException(typeof(IOException))]\r
        public void MoveException7 ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.Test.16";\r
-               string path2 = TempFolder + "/DirectoryTest.Test.17";\r
+               string path = TempFolder + DSC + "DirectoryTest.Test.16";\r
+               string path2 = TempFolder + DSC + "DirectoryTest.Test.17";\r
                \r
                DeleteDirectory (path);\r
                DeleteDirectory (path2);                \r
@@ -580,7 +581,7 @@ public class DirectoryTest : Assertion {
         [Ignore("Unix doesnt support CreationTime")]\r
        public void CreationTime ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.CreationTime.1";\r
+               string path = TempFolder + DSC + "DirectoryTest.CreationTime.1";\r
                DeleteDirectory (path);\r
                \r
                try {\r
@@ -627,7 +628,7 @@ public class DirectoryTest : Assertion {
        [Test]\r
        public void LastAccessTime ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.AccessTime.1";\r
+               string path = TempFolder + DSC + "DirectoryTest.AccessTime.1";\r
                DeleteDirectory (path);\r
                \r
                try {\r
@@ -674,7 +675,7 @@ public class DirectoryTest : Assertion {
        [Test]\r
        public void LastWriteTime ()\r
        {\r
-               string path = TempFolder + "/DirectoryTest.WriteTime.1";\r
+               string path = TempFolder + DSC + "DirectoryTest.WriteTime.1";\r
                DeleteDirectory (path);         \r
                \r
                try {\r
@@ -739,7 +740,7 @@ public class DirectoryTest : Assertion {
        public void SetLastWriteTimeException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);             \r
-               string path = TempFolder + "/DirectoryTest.SetLastWriteTime.2";\r
+               string path = TempFolder + DSC + "DirectoryTest.SetLastWriteTime.2";\r
                DeleteDirectory (path);\r
                try {\r
                        Directory.SetLastWriteTime (path, time);\r
@@ -803,7 +804,7 @@ public class DirectoryTest : Assertion {
        public void SetLastWriteTimeUtcException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);             \r
-               string path = TempFolder + "/DirectoryTest.SetLastWriteTimeUtc.2";\r
+               string path = TempFolder + DSC + "DirectoryTest.SetLastWriteTimeUtc.2";\r
                DeleteDirectory (path);\r
                try {\r
                        Directory.SetLastWriteTimeUtc (path, time);\r
@@ -833,7 +834,7 @@ public class DirectoryTest : Assertion {
 //     public void SetLastWriteTimeUtcException6 ()\r
 //     {\r
 //             DateTime time = new DateTime (1000, 4, 6, 6, 4, 2);\r
-//             string path = TempFolder + "/DirectoryTest.SetLastWriteTimeUtc.1";\r
+//             string path = TempFolder + DSC + "DirectoryTest.SetLastWriteTimeUtc.1";\r
 //\r
 //             if (!Directory.Exists (path))\r
 //                     Directory.CreateDirectory (path);\r
@@ -865,7 +866,7 @@ public class DirectoryTest : Assertion {
        public void SetLastAccessTimeException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);             \r
-               string path = TempFolder + "/DirectoryTest.SetLastAccessTime.2";\r
+               string path = TempFolder + DSC + "DirectoryTest.SetLastAccessTime.2";\r
                DeleteDirectory (path);\r
                try {\r
                        Directory.SetLastAccessTime (path, time);\r
@@ -895,7 +896,7 @@ public class DirectoryTest : Assertion {
 //     public void SetLastAccessTimeException6 ()\r
 //     {\r
 //             DateTime time = new DateTime (1003, 4, 6, 6, 4, 2);\r
-//             string path = TempFolder + "/DirectoryTest.SetLastAccessTime.1";\r
+//             string path = TempFolder + DSC + "DirectoryTest.SetLastAccessTime.1";\r
 //\r
 //             if (!Directory.Exists (path))                   \r
 //                     Directory.CreateDirectory (path);\r
@@ -928,7 +929,7 @@ public class DirectoryTest : Assertion {
        public void SetLastAccessTimeUtcException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);             \r
-               string path = TempFolder + "/DirectoryTest.SetLastAccessTimeUtc.2";\r
+               string path = TempFolder + DSC + "DirectoryTest.SetLastAccessTimeUtc.2";\r
                DeleteDirectory (path);\r
                try {\r
                        Directory.SetLastAccessTimeUtc (path, time);\r
@@ -958,7 +959,7 @@ public class DirectoryTest : Assertion {
 //     public void SetLastAccessTimeUtcException6 ()\r
 //     {\r
 //             DateTime time = new DateTime (1000, 4, 6, 6, 4, 2);\r
-//             string path = TempFolder + "/DirectoryTest.SetLastAccessTimeUtc.1";\r
+//             string path = TempFolder + DSC + "DirectoryTest.SetLastAccessTimeUtc.1";\r
 //\r
 //             if (!Directory.Exists (path))\r
 //                     Directory.CreateDirectory (path);\r
@@ -989,7 +990,7 @@ public class DirectoryTest : Assertion {
        public void SetCreationTimeException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);             \r
-               string path = TempFolder + "/DirectoryTest.SetCreationTime.2";\r
+               string path = TempFolder + DSC + "DirectoryTest.SetCreationTime.2";\r
                DeleteDirectory (path);\r
                \r
                try {\r
@@ -1020,7 +1021,7 @@ public class DirectoryTest : Assertion {
 //     public void SetCreationTimeException6 ()\r
 //     {\r
 //             DateTime time = new DateTime (1003, 4, 6, 6, 4, 2);\r
-//             string path = TempFolder + "/DirectoryTest.SetCreationTime.1";\r
+//             string path = TempFolder + DSC + "DirectoryTest.SetCreationTime.1";\r
 //\r
 //             if (!Directory.Exists (path))                   \r
 //                     Directory.CreateDirectory (path);\r
@@ -1054,7 +1055,7 @@ public class DirectoryTest : Assertion {
        public void SetCreationTimeUtcException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);             \r
-               string path = TempFolder + "/DirectoryTest.SetLastAccessTimeUtc.2";\r
+               string path = TempFolder + DSC + "DirectoryTest.SetLastAccessTimeUtc.2";\r
                DeleteDirectory (path);\r
                \r
                try {\r
@@ -1086,7 +1087,7 @@ public class DirectoryTest : Assertion {
 //     public void SetCreationTimeUtcException6 ()\r
 //     {\r
 //             DateTime time = new DateTime (1000, 4, 6, 6, 4, 2);\r
-//             string path = TempFolder + "/DirectoryTest.SetLastAccessTimeUtc.1";\r
+//             string path = TempFolder + DSC + "DirectoryTest.SetLastAccessTimeUtc.1";\r
 //\r
 //             if (!Directory.Exists (path))\r
 //                     Directory.CreateDirectory (path);\r
index 95858f178f76f3214aac925ca7d8327168752441..d6a4d3afb47ee20dfa829e4c4f0ce7e9e817de73 100644 (file)
@@ -21,6 +21,7 @@ namespace MonoTests.System.IO
         public class FileStreamTest : Assertion
         {
                string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");
+               static readonly char DSC = Path.DirectorySeparatorChar;
 
                [TearDown]
                public void TearDown()
@@ -40,7 +41,7 @@ namespace MonoTests.System.IO
 
                 public void TestCtr ()
                 {
-                       string path = TempFolder + "/testfilestream.tmp.1";
+                       string path = TempFolder + DSC + "testfilestream.tmp.1";
                        DeleteFile (path);
                        FileStream stream = null;
                        try {
@@ -74,11 +75,11 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (FileNotFoundException))]
                public void CtorFileNotFoundException1 ()
                {
-                       string path = TempFolder + "/thisfileshouldnotexists.test";
+                       string path = TempFolder + DSC + "thisfileshouldnotexists.test";
                        DeleteFile (path);
                        FileStream stream = null;
                        try {                           
-                               stream = new FileStream (TempFolder + "/thisfileshouldnotexists.test", FileMode.Open);
+                               stream = new FileStream (TempFolder + DSC + "thisfileshouldnotexists.test", FileMode.Open);
                        } finally {
                                if (stream != null)
                                        stream.Close ();
@@ -90,12 +91,12 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (FileNotFoundException))]
                public void CtorFileNotFoundException2 ()
                {
-                       string path = TempFolder + "/thisfileshouldNOTexists.test";
+                       string path = TempFolder + DSC + "thisfileshouldNOTexists.test";
                        DeleteFile (path);
                        FileStream stream = null;
 
                        try {
-                               stream = new FileStream (TempFolder + "/thisfileshouldNOTexists.test", FileMode.Truncate);
+                               stream = new FileStream (TempFolder + DSC + "thisfileshouldNOTexists.test", FileMode.Truncate);
                        } finally {
                                if (stream != null)
                                        stream.Close ();
@@ -108,7 +109,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (IOException))]
                public void CtorIOException1 ()
                {
-                       string path = TempFolder + "/thisfileshouldexists.test";
+                       string path = TempFolder + DSC + "thisfileshouldexists.test";
                        FileStream stream = null;
                        DeleteFile (path);
                        try {
@@ -161,13 +162,13 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (DirectoryNotFoundException))]
                public void CtorDirectoryNotFoundException ()
                {
-                       string path = TempFolder + "/thisDirectoryShouldNotExists";
+                       string path = TempFolder + DSC + "thisDirectoryShouldNotExists";
                        if (Directory.Exists (path))
                                Directory.Delete (path, true);
 
                        FileStream stream = null;                               
                        try {
-                               stream = new FileStream (path + "/eitherthisfile.test", FileMode.CreateNew);
+                               stream = new FileStream (path + DSC + "eitherthisfile.test", FileMode.CreateNew);
                        } finally {
 
                                if (stream != null)
@@ -182,7 +183,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (ArgumentOutOfRangeException))]
                public void CtorArgumentOutOfRangeException3 ()
                {
-                       string path = TempFolder + "/CtorArgumentOutOfRangeException1";
+                       string path = TempFolder + DSC + "CtorArgumentOutOfRangeException1";
                        DeleteFile (path);
                        
                        FileStream stream = null;
@@ -199,7 +200,7 @@ namespace MonoTests.System.IO
                [ExpectedException (typeof (ArgumentOutOfRangeException))]
                public void CtorArgumentOutOfRangeException4 ()
                {
-                       string path = TempFolder + "/CtorArgumentOutOfRangeException2";
+                       string path = TempFolder + DSC + "CtorArgumentOutOfRangeException4";
                        DeleteFile (path);
 
                        FileStream stream = null;
@@ -305,7 +306,7 @@ namespace MonoTests.System.IO
                [Test, ExpectedException(typeof(IOException))]
                public void CtorIOException ()
                {                       
-                       string path = TempFolder + "/CTorIOException.Test";
+                       string path = TempFolder + DSC + "CTorIOException.Test";
                        FileStream stream = null;
                        FileStream stream2 = null;
                        DeleteFile (path);
@@ -327,7 +328,7 @@ namespace MonoTests.System.IO
                [Test]
                public void Write ()
                {
-                       string path = TempFolder + "/FileStreamTest.Write";
+                       string path = TempFolder + DSC + "FileStreamTest.Write";
 
                        DeleteFile (path);
 
@@ -364,7 +365,7 @@ namespace MonoTests.System.IO
                {
                        // Test that the Length property takes into account the data
                        // in the buffer
-                       string path = TempFolder + "/FileStreamTest.Length";
+                       string path = TempFolder + DSC + "FileStreamTest.Length";
 
                        DeleteFile (path);
 
@@ -380,7 +381,7 @@ namespace MonoTests.System.IO
                [Test]
                public void Flush ()
                {
-                       string path = TempFolder + "/FileStreamTest.Flush";
+                       string path = TempFolder + DSC + "FileStreamTest.Flush";
                        FileStream stream = null;
                        FileStream stream2 = null;
 
@@ -509,7 +510,7 @@ namespace MonoTests.System.IO
                 [Test]
                 public void Seek ()
                 {
-                       string path = TempFolder + "/FST.Seek.Test";
+                       string path = TempFolder + DSC + "FST.Seek.Test";
                        DeleteFile (path);                      
 
                        FileStream stream = new FileStream (path, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite);
index 4cbf15d1f4b2c08faec99941c36e95a6ac420d9d..2c664ad6b9b454c3ebb418e51776ce7780d6b369 100644 (file)
@@ -18,6 +18,7 @@ namespace MonoTests.System.IO
         public class FileSystemInfoTest : Assertion
        {
                string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");
+               static readonly char DSC = Path.DirectorySeparatorChar;
 
                [SetUp]
                protected void SetUp() 
@@ -70,7 +71,7 @@ namespace MonoTests.System.IO
                [Test]
                public void CreationTimeFile ()
                {
-                       string path = TempFolder + "/FSIT.CreationTime.Test";
+                       string path = TempFolder + DSC + "FSIT.CreationTime.Test";
                        DeleteFile (path);
                        if (Unix) {  // Unix doesn't support CreationTimes
                          return;
@@ -122,7 +123,7 @@ namespace MonoTests.System.IO
                [Test]
                public void CreationTimeDirectory ()
                {
-                       string path = TempFolder + "/FSIT.CreationTimeDirectory.Test";
+                       string path = TempFolder + DSC + "FSIT.CreationTimeDirectory.Test";
                        DeleteDir (path);
                        if (Unix) {  // Unix doesn't support CreationTimes
                          return;
@@ -163,7 +164,7 @@ namespace MonoTests.System.IO
                [Test]
                public void CreationTimeNoFileOrDirectory ()
                {
-                       string path = TempFolder + "/FSIT.CreationTimeNoFile.Test";
+                       string path = TempFolder + DSC + "FSIT.CreationTimeNoFile.Test";
                        DeleteFile (path);
                        DeleteDir (path);
                        
@@ -198,7 +199,7 @@ namespace MonoTests.System.IO
                [Test]
                public void Extenssion ()
                {
-                       string path = TempFolder + "/FSIT.Extenssion.Test";
+                       string path = TempFolder + DSC + "FSIT.Extenssion.Test";
                        DeleteFile (path);
                        
                        try {
@@ -212,7 +213,7 @@ namespace MonoTests.System.IO
                [Test]
                public void DefaultLastAccessTime ()
                {
-                       string path = TempFolder + "/FSIT.DefaultLastAccessTime.Test";
+                       string path = TempFolder + DSC + "FSIT.DefaultLastAccessTime.Test";
                        DeleteFile (path);
                        
                        try {
@@ -235,7 +236,7 @@ namespace MonoTests.System.IO
                [Test]
                public void LastAccessTime ()
                {
-                       string path = TempFolder + "/FSIT.LastAccessTime.Test";
+                       string path = TempFolder + DSC + "FSIT.LastAccessTime.Test";
                        DeleteFile (path);
 
                        try {
@@ -278,7 +279,7 @@ namespace MonoTests.System.IO
                [Test]
                public void DefaultLastWriteTime ()
                {
-                       string path = TempFolder + "/FSIT.DefaultLastWriteTime.Test";
+                       string path = TempFolder + DSC + "FSIT.DefaultLastWriteTime.Test";
                        DeleteDir (path);
 
                        try {
@@ -301,7 +302,7 @@ namespace MonoTests.System.IO
                [Test]
                public void LastWriteTime ()
                {
-                       string path = TempFolder + "/FSIT.LastWriteTime.Test";
+                       string path = TempFolder + DSC + "FSIT.LastWriteTime.Test";
                        DeleteDir (path);
                        
                        try {