public void IsJunction_WithJunction_ReturnsTrue() { var ret = TestUtils.CreateJunctionAndTarget(TempFolder); var junction = ret.Item2; var path = new WindowsPath(junction); Assert.IsTrue(path.IsJunction()); }
public void ExpandUser_WithHomeDir_ExpandsDir() { var path = new WindowsPath("~/tmp"); var expected = new WindowsPath( Environment.GetEnvironmentVariable("USERPROFILE"), "tmp"); var actual = path.ExpandUser(); Assert.AreEqual(expected, actual); }
public void ExpandUser_WithCustomHomeDirString_ExpandsDir() { var homeDir = new WindowsPath(@"C:\users\test"); var path = new WindowsPath("~/tmp"); var expected = homeDir.Join("tmp"); var actual = path.ExpandUser(homeDir); Assert.AreEqual(expected, actual); }
public void JoinIPath_WithAnotherPath_ReturnsWindowsPath() { IPath path = new WindowsPath(@"C:\tmp"); IPath other = new WindowsPath(@"C:\tmp"); var final = path.Join(other); Assert.IsTrue(final is WindowsPath); }
public void SetCurrentDirectory_WithDirectory_SetsEnvironmentVariable() { const string newCwd = @"C:\"; var path = new WindowsPath(newCwd); using (path.SetCurrentDirectory()) { Assert.AreEqual(newCwd, Environment.CurrentDirectory); } }
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); }