Exemplo n.º 1
0
        public void Delete_Symlink()
        {
            SetupTests();

            ReparsePoint.Create(SymlinkPath, FirstTargetPath, true, ReparsePoint.LinkType.DirectoryLink);
            ReparsePoint.Delete(SymlinkPath);

            Assert.IsFalse(Directory.Exists(SymlinkPath));
        }
Exemplo n.º 2
0
        public void Create_And_GetTarget_Symlink()
        {
            SetupTests();

            ReparsePoint.Create(SymlinkPath, FirstTargetPath, true, ReparsePoint.LinkType.DirectoryLink);
            var measuredTargetPath = ReparsePoint.GetTarget(SymlinkPath);

            Assert.AreEqual(FirstTargetPath, measuredTargetPath, true);
        }
Exemplo n.º 3
0
        public void Copy_Files_From_Symlink()
        {
            SetupTests();

            var originalFiles = Directory.GetFiles(FirstTargetPath).Length;

            ReparsePoint.Create(SymlinkPath, FirstTargetPath, true, ReparsePoint.LinkType.DirectoryLink);
            FileActions.CopyDirectory(SymlinkPath, SecondTargetPath);

            var measuredFiles = Directory.GetFiles(SecondTargetPath).Length;

            Assert.AreEqual(originalFiles, measuredFiles);
        }
Exemplo n.º 4
0
        public void Create_And_Move_Symlink()
        {
            SetupTests();

            var originalFiles       = Directory.GetFiles(FirstTargetPath).Length + Directory.GetDirectories(FirstTargetPath).Length;
            var originalTargetFiles = Directory.GetFiles(SecondTargetPath).Length + Directory.GetDirectories(SecondTargetPath).Length;

            ReparsePoint.Create(SymlinkPath, FirstTargetPath, true, ReparsePoint.LinkType.DirectoryLink);
            var doubles = ReparsePoint.Move(SymlinkPath, SecondTargetPath, true, ReparsePoint.LinkType.DirectoryLink);

            var measuredTargetPath = ReparsePoint.GetTarget(SymlinkPath);
            var measuredFiles      = Directory.GetFiles(SecondTargetPath).Length + Directory.GetDirectories(SecondTargetPath).Length;

            Assert.AreEqual(SecondTargetPath, measuredTargetPath, true);
            Assert.AreEqual(originalFiles, measuredFiles - originalTargetFiles + doubles);
        }