Пример #1
0
        public void TestSetCreationTimeUtcNonExistentDir()
        {
            var tempLongPathFilename = longPathDirectory.Combine(Pri.LongPath.Path.GetRandomFileName());
            var dateTime             = DateTime.UtcNow.AddDays(1);

            Assert.Throws <FileNotFoundException>(() => Directory.SetCreationTimeUtc(tempLongPathFilename, dateTime));
        }
Пример #2
0
        public void TestSetCreationTimeUtc()
        {
            var tempLongPathFilename = longPathDirectory.Combine(Pri.LongPath.Path.GetRandomFileName());

            tempLongPathFilename.CreateDirectory();

            try {
                var dateTime = DateTime.UtcNow.AddDays(1);
                Directory.SetCreationTimeUtc(tempLongPathFilename, dateTime);
                var di = new DirectoryInfo(tempLongPathFilename);
                Assert.AreEqual(di.CreationTimeUtc, dateTime);
            }
            finally {
                Directory.Delete(tempLongPathFilename);
            }
        }