Ejemplo n.º 1
0
        public void IsJunction_WithJunction_ReturnsTrue()
        {
            var ret = TestUtils.CreateJunctionAndTarget(TempFolder);
            var junction = ret.Item2;

            var path = new WindowsPath(junction);

            Assert.IsTrue(path.IsJunction());
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public void SetCurrentDirectory_WithDirectory_SetsEnvironmentVariable()
 {
     const string newCwd = @"C:\";
     var path = new WindowsPath(newCwd);
     using (path.SetCurrentDirectory())
     {
         Assert.AreEqual(newCwd, Environment.CurrentDirectory);
     }
 }
Ejemplo n.º 6
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);
        }