Esempio n. 1
0
        public void DontRecreateDirectory()
        {
            var dir = TemporaryDirectory.CreateLocalTemporaryDirectory(false);

            File.WriteAllText(Path.Combine(dir.Path.FullName, "file"), "Test");
            using (var temp = new TemporaryDirectory(dir, true))
                Assert.AreEqual("Test", File.ReadAllText("file"));
        }
Esempio n. 2
0
        public void Local()
        {
            using (var dir = TemporaryDirectory.CreateLocalTemporaryDirectory(false))
                Assert.AreEqual(new DirectoryInfo("./").FullName.TrimEnd('/', '\\'), dir.Path.Parent.FullName.TrimEnd('/', '\\'));

            var current = System.Environment.CurrentDirectory;

            using (var dir = TemporaryDirectory.CreateLocalTemporaryDirectory(true))
                Assert.AreEqual(System.Environment.CurrentDirectory, dir);
            Assert.AreEqual(current, System.Environment.CurrentDirectory);
        }