Exemplo n.º 1
0
        public void TestSetLastAccessTimeUtcNonExistentDir()
        {
            var tempLongPathFilename = longPathDirectory.Combine(Pri.LongPath.Path.GetRandomFileName());
            var dateTime             = DateTime.UtcNow.AddDays(1);

            Assert.Throws <FileNotFoundException>(() => Directory.SetLastAccessTimeUtc(tempLongPathFilename, dateTime));
        }
Exemplo n.º 2
0
        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);
            }
        }