public void SetUp() { _tmpDirInfo = new DirectoryInfo(TmpDirPath); _tmpDirInfo.Create(); _tmpDirInfo2 = new DirectoryInfo(TmpDirPath2); _tmpDirInfo2.Create(); _tmpDirInfo3 = new DirectoryInfo(TmpDirPath3); _tmpDirInfo3.Create(); _tmpDirInfo4 = new DirectoryInfo(TmpDirPath4); _tmpDirInfo4.Create(); _tmpDirInfo5 = new DirectoryInfo(TmpDirPath5); _tmpDirInfo5.Create(); _tmpDirInfo6 = new DirectoryInfo(TmpDirPath6); _tmpDirInfo6.Create(); _tmpDirInfo.CreateSubdirectory(PathUtil.Combine("a", "b", "c")).Create(); _tmpDirInfo.CreateSubdirectory(PathUtil.Combine("a", "d", ".git", "store")).Create(); _tmpDirInfo.CreateSubdirectory(PathUtil.Combine("a", "e")).Create(); _tmpDirInfo4.CreateSubdirectory(PathUtil.Combine("dir1", "dir2")).Create(); _tmpDirInfo5.CreateSubdirectory(PathUtil.Combine("dir3", "dir4")).Create(); SymbolicLinkHelper.CreateSymbolicLink(new DirectoryInfo(PathUtil.Combine("..", "..", "..", TmpDirPath2)), new FileInfo(PathUtil.Combine(_tmpDirInfo.ToString(), "a", "e", "link-to-dir"))); // These links create cycles to make sure they are handled correctly. SymbolicLinkHelper.CreateSymbolicLink(new DirectoryInfo(PathUtil.Combine("..", "..")), new FileInfo(PathUtil.Combine(_tmpDirInfo.ToString(), "a", "e", "link-to-parent-of-parent"))); SymbolicLinkHelper.CreateSymbolicLink(new DirectoryInfo(PathUtil.Combine("..", TmpDirPath + Path.DirectorySeparatorChar)), new FileInfo(PathUtil.Combine(_tmpDirInfo.ToString(), "link-to-self"))); SymbolicLinkHelper.CreateSymbolicLink(new DirectoryInfo(PathUtil.Combine("..", TmpDirPath3)), new FileInfo(PathUtil.Combine(_tmpDirInfo3.ToString(), "link-to-self"))); SymbolicLinkHelper.CreateSymbolicLink(new DirectoryInfo(PathUtil.Combine("..", "..", "..", TmpDirPath5)), new FileInfo(PathUtil.Combine(_tmpDirInfo4.ToString(), "dir1", "dir2", "link-to-other"))); }
public void TestCreatePlaceHolders2() { var symlinkTestDir = _tmpDirInfo6; symlinkTestDir.Create(); symlinkTestDir.CreateSubdirectory(PathUtil.Combine("foo", "empty")); SymbolicLinkHelper.CreateSymbolicLink(new DirectoryInfo(PathUtil.Combine("foo", "empty")), new FileInfo(PathUtil.Combine(TmpDirPath6, "empty"))); var config = MainClass.CreateConfiguration(); config.FollowSymbolicLinks = false; config.Directory = symlinkTestDir; var cmd = new SyncCommand(); cmd.Execute(config); Assert.AreEqual(1, new DirectoryInfo(PathUtil.Combine(TmpDirPath6, "foo", "empty")).GetFileSystemInfos().Length); }