コード例 #1
0
        public void TestSetLastWriteTimeUtcNonExistentDir()
        {
            var tempLongPathFilename = longPathDirectory.Combine(Pri.LongPath.Path.GetRandomFileName());
            var dateTime             = DateTime.UtcNow.AddDays(1);

            Assert.Throws <FileNotFoundException>(() => Directory.SetLastWriteTimeUtc(tempLongPathFilename, dateTime));
        }
コード例 #2
0
        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);
            }
        }