namespace MonoTests.System.IO\r
{\r
[TestFixture]\r
- public class DirectoryInfoTest\r
+ public class DirectoryInfoTest : 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
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
- Assertion.AssertEquals ("test#01", true, info.DirectoryName.EndsWith (".Tests"));\r
- Assertion.AssertEquals ("test#02", false, info.Exists);\r
- Assertion.AssertEquals ("test#03", ".Test", info.Extension);\r
- Assertion.AssertEquals ("test#05", "DIT.Ctr.Test", info.Name); \r
+ AssertEquals ("test#01", true, info.DirectoryName.EndsWith (".Tests"));\r
+ AssertEquals ("test#02", false, info.Exists);\r
+ AssertEquals ("test#03", ".Test", info.Extension);\r
+ AssertEquals ("test#05", "DIT.Ctr.Test", info.Name); \r
}\r
\r
[Test]\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
DirectoryInfo info = new DirectoryInfo (path);\r
- Assertion.AssertEquals ("test#01", false, info.Exists);\r
+ AssertEquals ("test#01", false, info.Exists);\r
\r
Directory.CreateDirectory (path);\r
- Assertion.AssertEquals ("test#02", false, info.Exists);\r
+ AssertEquals ("test#02", false, info.Exists);\r
info = new DirectoryInfo (path);\r
- Assertion.AssertEquals ("test#03", true, info.Exists); \r
+ AssertEquals ("test#03", true, info.Exists); \r
} finally {\r
DeleteDir (path);\r
}\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
DirectoryInfo info = new DirectoryInfo (path); \r
- Assertion.AssertEquals ("test#01", "DIT.Name.Test", info.Name);\r
+ AssertEquals ("test#01", "DIT.Name.Test", info.Name);\r
\r
info = Directory.CreateDirectory (path);\r
- Assertion.AssertEquals ("test#02", "DIT.Name.Test", info.Name);\r
+ AssertEquals ("test#02", "DIT.Name.Test", info.Name);\r
\r
\r
} finally {\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
DirectoryInfo info = new DirectoryInfo (path);\r
- Assertion.AssertEquals ("test#01", "MonoTests.System.IO.Tests", info.Parent.Name);\r
+ AssertEquals ("test#01", "MonoTests.System.IO.Tests", info.Parent.Name);\r
\r
info = Directory.CreateDirectory (path);\r
- Assertion.AssertEquals ("test#02", "MonoTests.System.IO.Tests", info.Parent.Name);\r
+ AssertEquals ("test#02", "MonoTests.System.IO.Tests", info.Parent.Name);\r
\r
} finally {\r
DeleteDir (path);\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
DirectoryInfo info = new DirectoryInfo (path);\r
- Assertion.AssertEquals ("test#01", false, info.Exists);\r
+ AssertEquals ("test#01", false, info.Exists);\r
info.Create (); \r
- Assertion.AssertEquals ("test#02", false, info.Exists);\r
+ AssertEquals ("test#02", false, info.Exists);\r
info = new DirectoryInfo (path);\r
- Assertion.AssertEquals ("test#03", true, info.Exists);\r
+ AssertEquals ("test#03", true, info.Exists);\r
} finally {\r
DeleteDir (path);\r
}\r
}\r
\r
+ [Test]\r
+ public void CreateSubdirectory ()\r
+ {\r
+ string sub_path = Path.Combine ("test01", "test02");\r
+ try {\r
+ DirectoryInfo info = new DirectoryInfo (TempFolder);\r
+ info.CreateSubdirectory (sub_path);\r
+ Assert ("test#01", Directory.Exists (Path.Combine (TempFolder, sub_path)));\r
+ } finally {\r
+ DeleteDir (Path.Combine (TempFolder, sub_path));\r
+ }\r
+ \r
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void CreateSubdirectoryEmptyString ()
+ {
+ new DirectoryInfo (".").CreateSubdirectory ("");
+ }\r
+\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
Directory.CreateDirectory (path);\r
DirectoryInfo info = new DirectoryInfo (path);\r
- Assertion.AssertEquals ("test#01", true, info.Exists);\r
+ AssertEquals ("test#01", true, info.Exists);\r
\r
info.Delete ();\r
- Assertion.AssertEquals ("test#02", true, info.Exists);\r
+ AssertEquals ("test#02", true, info.Exists);\r
\r
info = new DirectoryInfo (path);\r
- Assertion.AssertEquals ("test#03", false, info.Exists);\r
+ AssertEquals ("test#03", false, info.Exists);\r
} finally {\r
DeleteDir (path);\r
}\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
- Assertion.AssertEquals ("test#01", true, info.Exists);\r
+ AssertEquals ("test#01", true, info.Exists);\r
\r
info.Delete (true);\r
- Assertion.AssertEquals ("test#02", true, info.Exists);\r
+ AssertEquals ("test#02", true, info.Exists);\r
\r
info = new DirectoryInfo (path);\r
- Assertion.AssertEquals ("test#03", false, info.Exists);\r
+ AssertEquals ("test#03", false, info.Exists);\r
} finally {\r
DeleteDir (path);\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
DeleteDir (path);\r
}\r
+ }
+
+ [Test]
+ // from bug #75443
+ public void FullName ()
+ {
+ DirectoryInfo di = new DirectoryInfo ("something");
+ Assert ("Exists", !di.Exists);
+ Assert ("FullName", di.FullName.EndsWith ("something"));
+
+ di = new DirectoryInfo ("something" + Path.DirectorySeparatorChar);
+ AssertEquals ("DirectorySeparatorChar", Path.DirectorySeparatorChar, di.FullName [di.FullName.Length - 1]);
+
+ di = new DirectoryInfo ("something" + Path.AltDirectorySeparatorChar);
+ AssertEquals ("AltDirectorySeparatorChar", Path.DirectorySeparatorChar, di.FullName [di.FullName.Length - 1]);
+ }\r
+
+ [Test]
+ public void FullName_RootDirectory ()
+ {
+ DirectoryInfo di = new DirectoryInfo (String.Empty + Path.DirectorySeparatorChar);
+ if (Path.DirectorySeparatorChar == '/') {
+ // can't be sure of the root drive under windows
+ AssertEquals ("FullName", di.FullName, "/");
+ }
+ AssertNull ("Parent", di.Parent);
+
+ di = new DirectoryInfo (String.Empty + Path.AltDirectorySeparatorChar);
+ if (Path.DirectorySeparatorChar == '/') {
+ // can't be sure of the root drive under windows
+ AssertEquals ("FullName-Alt", di.FullName, "/");
+ }
+ AssertNull ("Parent-Alt", di.Parent);
}\r
\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
- Assertion.AssertEquals ("test#01", 0, info.GetDirectories ().Length);\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
- Assertion.AssertEquals ("test#02", 2, info.GetDirectories ().Length);\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
- Assertion.AssertEquals ("test#02", 1, info.GetDirectories ().Length); \r
+ Directory.Delete (path + DSC + 2);\r
+ AssertEquals ("test#02", 1, info.GetDirectories ().Length); \r
\r
} finally {\r
DeleteDir (path);\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
- Assertion.AssertEquals ("test#01", 0, info.GetDirectories ("*").Length);\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
- Assertion.AssertEquals ("test#02", 4, info.GetDirectories ("*").Length);\r
- Assertion.AssertEquals ("test#03", 3, info.GetDirectories ("test*").Length);\r
- Assertion.AssertEquals ("test#04", 2, info.GetDirectories ("test?20").Length);\r
- Assertion.AssertEquals ("test#05", 0, info.GetDirectories ("test?").Length);\r
- Assertion.AssertEquals ("test#06", 0, info.GetDirectories ("test[12]*").Length);\r
- Assertion.AssertEquals ("test#07", 2, info.GetDirectories ("test2*0").Length);\r
- Assertion.AssertEquals ("test#08", 4, info.GetDirectories ("*test*").Length);\r
+ AssertEquals ("test#02", 4, info.GetDirectories ("*").Length);\r
+ AssertEquals ("test#03", 3, info.GetDirectories ("test*").Length);\r
+ AssertEquals ("test#04", 2, info.GetDirectories ("test?20").Length);\r
+ AssertEquals ("test#05", 0, info.GetDirectories ("test?").Length);\r
+ AssertEquals ("test#06", 0, info.GetDirectories ("test[12]*").Length);\r
+ AssertEquals ("test#07", 2, info.GetDirectories ("test2*0").Length);\r
+ AssertEquals ("test#08", 4, info.GetDirectories ("*test*").Length);\r
\r
} finally {\r
DeleteDir (path);\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
- Assertion.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
- Assertion.AssertEquals ("test#02", 2, info.GetFiles ().Length);\r
+ AssertEquals ("test#01", 0, info.GetFiles ().Length);\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
DeleteDir (path);\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
- Assertion.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
+ AssertEquals ("test#01", 0, info.GetFiles ("*").Length);\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
- Assertion.AssertEquals ("test#02", 6, info.GetFiles ("*").Length);\r
- Assertion.AssertEquals ("test#03", 2, info.GetFiles ("file*file").Length);\r
- Assertion.AssertEquals ("test#04", 3, info.GetFiles ("*file*").Length);\r
- Assertion.AssertEquals ("test#05", 2, info.GetFiles ("file?20file").Length);\r
- Assertion.AssertEquals ("test#07", 1, info.GetFiles ("*.abcd").Length);\r
- Assertion.AssertEquals ("test#08", 2, info.GetFiles ("*.abcd*").Length); \r
+ AssertEquals ("test#02", 6, info.GetFiles ("*").Length);\r
+ AssertEquals ("test#03", 2, info.GetFiles ("file*file").Length);\r
+ AssertEquals ("test#04", 3, info.GetFiles ("*file*").Length);\r
+ AssertEquals ("test#05", 2, info.GetFiles ("file?20file").Length);\r
+ AssertEquals ("test#07", 1, info.GetFiles ("*.abcd").Length);\r
+ AssertEquals ("test#08", 2, info.GetFiles ("*.abcd*").Length); \r
} finally {\r
DeleteDir (path);\r
}\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
DirectoryInfo info1 = Directory.CreateDirectory (path1);\r
DirectoryInfo info2 = new DirectoryInfo (path2);\r
\r
- Assertion.AssertEquals ("test#01", true, info1.Exists);\r
- Assertion.AssertEquals ("test#02", false, info2.Exists);\r
+ AssertEquals ("test#01", true, info1.Exists);\r
+ AssertEquals ("test#02", false, info2.Exists);\r
\r
info1.MoveTo (path2); \r
- Assertion.AssertEquals ("test#03", true, info1.Exists);\r
- Assertion.AssertEquals ("test#04", false, info2.Exists);\r
+ AssertEquals ("test#03", true, info1.Exists);\r
+ AssertEquals ("test#04", false, info2.Exists);\r
\r
info1 = new DirectoryInfo (path1);\r
info2 = new DirectoryInfo (path2);\r
- Assertion.AssertEquals ("test#05", false, info1.Exists);\r
- Assertion.AssertEquals ("test#06", true, info2.Exists);\r
+ AssertEquals ("test#05", false, info1.Exists);\r
+ AssertEquals ("test#06", true, info2.Exists);\r
\r
} finally {\r
DeleteDir (path1);\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
if (Directory.Exists (path))\r
Directory.Delete (path, true);\r
}\r
- \r
+
+ [Test]
+ public void DirectoryNameWithSpace ()
+ {
+ // check for Unix platforms - see FAQ for more details
+ // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
+ int platform = (int) Environment.OSVersion.Platform;
+ if ((platform == 4) || (platform == 128)) {
+ DeleteDir ("this has a space at the end ");
+ string path = Path.Combine (TempFolder, "this has a space at the end ");
+ Directory.CreateDirectory (path);
+ DirectoryInfo i = new DirectoryInfo (path);
+ string dummy = null;
+ foreach (FileInfo f in i.GetFiles ()) // This used to throw
+ dummy = f.Name;
+ }
+ }\r
+\r
+ [Test]\r
+ public void LastWriteTime ()\r
+ {\r
+ DirectoryInfo info = new DirectoryInfo (TempFolder);\r
+ info.LastWriteTime = new DateTime (2003, 6, 4, 6, 4, 0);\r
+\r
+ DateTime time = Directory.GetLastWriteTime (TempFolder);\r
+ AssertEquals ("test#01", 2003, time.Year);\r
+ AssertEquals ("test#02", 6, time.Month);\r
+ AssertEquals ("test#03", 4, time.Day);\r
+ AssertEquals ("test#04", 6, time.Hour);\r
+ AssertEquals ("test#05", 4, time.Minute);\r
+ AssertEquals ("test#06", 0, time.Second);\r
+\r
+ time = TimeZone.CurrentTimeZone.ToLocalTime (\r
+ Directory.GetLastWriteTimeUtc (TempFolder));\r
+ AssertEquals ("test#07", 2003, time.Year);\r
+ AssertEquals ("test#08", 6, time.Month);\r
+ AssertEquals ("test#09", 4, time.Day);\r
+ AssertEquals ("test#10", 6, time.Hour);\r
+ AssertEquals ("test#11", 4, time.Minute);\r
+ AssertEquals ("test#12", 0, time.Second);\r
+ }\r
+\r
+ [Test]\r
+ public void LastWriteTimeUtc ()\r
+ {\r
+ DirectoryInfo info = new DirectoryInfo (TempFolder);\r
+ info.LastWriteTimeUtc = new DateTime (2003, 6, 4, 6, 4, 0);\r
+\r
+ DateTime time = TimeZone.CurrentTimeZone.ToUniversalTime (\r
+ Directory.GetLastWriteTime (TempFolder));\r
+ AssertEquals ("test#1", 2003, time.Year);\r
+ AssertEquals ("test#2", 6, time.Month);\r
+ AssertEquals ("test#3", 4, time.Day);\r
+ AssertEquals ("test#4", 6, time.Hour);\r
+ AssertEquals ("test#5", 4, time.Minute);\r
+ AssertEquals ("test#6", 0, time.Second);\r
+\r
+ time = Directory.GetLastWriteTimeUtc (TempFolder);\r
+ AssertEquals ("test#7", 2003, time.Year);\r
+ AssertEquals ("test#8", 6, time.Month);\r
+ AssertEquals ("test#9", 4, time.Day);\r
+ AssertEquals ("test#10", 6, time.Hour);\r
+ AssertEquals ("test#11", 4, time.Minute);\r
+ AssertEquals ("test#12", 0, time.Second);\r
+ }\r
+\r
+ [Test]\r
+ public void LastAccessTime ()\r
+ {\r
+ DirectoryInfo info = new DirectoryInfo (TempFolder);\r
+ info.LastAccessTime = DateTime.Now;\r
+ }\r
+\r
+ [Test]\r
+ public void LastAccessTimeUtc ()\r
+ {\r
+ DirectoryInfo info = new DirectoryInfo (TempFolder);\r
+ info.LastAccessTimeUtc = DateTime.Now;\r
+ }\r
+\r
+ [Test]\r
+ public void CreationTime ()\r
+ {\r
+ DirectoryInfo info = new DirectoryInfo (TempFolder);\r
+ info.CreationTime = DateTime.Now;\r
+ }\r
+\r
+ [Test]\r
+ public void CreationTimeUtc ()\r
+ {\r
+ DirectoryInfo info = new DirectoryInfo (TempFolder);\r
+ info.CreationTimeUtc = DateTime.Now;\r
+ }
}\r
}\r