{\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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
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
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
// 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
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
// 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
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
// 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
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
// 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
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
// 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
public class FileStreamTest : Assertion
{
string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");
+ static readonly char DSC = Path.DirectorySeparatorChar;
[TearDown]
public void TearDown()
public void TestCtr ()
{
- string path = TempFolder + "/testfilestream.tmp.1";
+ string path = TempFolder + DSC + "testfilestream.tmp.1";
DeleteFile (path);
FileStream stream = null;
try {
[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 ();
[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 ();
[ExpectedException (typeof (IOException))]
public void CtorIOException1 ()
{
- string path = TempFolder + "/thisfileshouldexists.test";
+ string path = TempFolder + DSC + "thisfileshouldexists.test";
FileStream stream = null;
DeleteFile (path);
try {
[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)
[ExpectedException (typeof (ArgumentOutOfRangeException))]
public void CtorArgumentOutOfRangeException3 ()
{
- string path = TempFolder + "/CtorArgumentOutOfRangeException1";
+ string path = TempFolder + DSC + "CtorArgumentOutOfRangeException1";
DeleteFile (path);
FileStream stream = null;
[ExpectedException (typeof (ArgumentOutOfRangeException))]
public void CtorArgumentOutOfRangeException4 ()
{
- string path = TempFolder + "/CtorArgumentOutOfRangeException2";
+ string path = TempFolder + DSC + "CtorArgumentOutOfRangeException4";
DeleteFile (path);
FileStream stream = null;
[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);
[Test]
public void Write ()
{
- string path = TempFolder + "/FileStreamTest.Write";
+ string path = TempFolder + DSC + "FileStreamTest.Write";
DeleteFile (path);
{
// 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);
[Test]
public void Flush ()
{
- string path = TempFolder + "/FileStreamTest.Flush";
+ string path = TempFolder + DSC + "FileStreamTest.Flush";
FileStream stream = null;
FileStream stream2 = null;
[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);