public void TestSetLastAccessTimeUtcNonExistentDir() { var tempLongPathFilename = longPathDirectory.Combine(Pri.LongPath.Path.GetRandomFileName()); var dateTime = DateTime.UtcNow.AddDays(1); Assert.Throws <FileNotFoundException>(() => Directory.SetLastAccessTimeUtc(tempLongPathFilename, dateTime)); }
public void TestSetLastAccessTimeUtc() { var tempLongPathFilename = longPathDirectory.Combine(Pri.LongPath.Path.GetRandomFileName()); tempLongPathFilename.CreateDirectory(); try { var dateTime = DateTime.UtcNow.AddDays(1); Directory.SetLastAccessTimeUtc(tempLongPathFilename, dateTime); var fi = new DirectoryInfo(tempLongPathFilename); Assert.AreEqual(fi.LastAccessTimeUtc, dateTime); } finally { Directory.Delete(tempLongPathFilename); } }