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); }
private static void Prepare(System.Action action) { using (TemporaryDirectory.CreateTemporaryDirectory(setCurrentDirectory: true)) action(); }