示例#1
0
 public void SetCurrentDirectory_WithDirectory_SetsEnvironmentVariable()
 {
     const string newCwd = @"C:\";
     var path = new WindowsPath(newCwd);
     using (path.SetCurrentDirectory())
     {
         Assert.AreEqual(newCwd, Environment.CurrentDirectory);
     }
 }
示例#2
0
        public void SetCurrentDirectory_UponDispose_RestoresEnvironmentVariable()
        {
            var oldCwd = Environment.CurrentDirectory;
            var path = new WindowsPath(@"C:\");
            var tmp = path.SetCurrentDirectory();

            tmp.Dispose();

            Assert.AreEqual(oldCwd, Environment.CurrentDirectory);
        }