Пример #1
0
        public void Delete_Symlink()
        {
            SetupTests();

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

            Assert.IsFalse(Directory.Exists(SymlinkPath));
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }