示例#1
0
        public void Temp()
        {
            using (var dir = TemporaryDirectory.CreateTemporaryDirectory(false))
                Assert.AreEqual(new DirectoryInfo(System.IO.Path.GetTempPath()).FullName.TrimEnd('/', '\\'), dir.Path.Parent.FullName.TrimEnd('/', '\\'));

            var current = System.Environment.CurrentDirectory;

            using (var dir = TemporaryDirectory.CreateTemporaryDirectory(true))
                Assert.AreEqual(System.Environment.CurrentDirectory, dir);
            Assert.AreEqual(current, System.Environment.CurrentDirectory);
        }
示例#2
0
 private static void Prepare(System.Action action)
 {
     using (TemporaryDirectory.CreateTemporaryDirectory(setCurrentDirectory: true))
         action();
 }