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