public void TestSyncPlaceHolders() { TestCreatePlaceHolders(); var file1 = new FileInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "b", "c", "file1")); file1.Create().Close(); var dir12 = new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d", "dir1", "dir2")); dir12.Create(); var config = MainClass.CreateConfiguration(); config.Directory = _tmpDirInfo; var cmd = new SyncCommand(); cmd.Execute(config); Assert.IsFalse(new FileInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "b", "c", ".emptydir")).Exists); Assert.AreEqual(1, new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "b", "c")).GetFiles().Length); Assert.IsTrue(new FileInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d", "dir1", "dir2", ".emptydir")).Exists); Assert.AreEqual(1, new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d", "dir1", "dir2")).GetFiles().Length); Assert.IsEmpty(_tmpDirInfo.GetFiles()); Assert.IsEmpty(new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a")).GetFiles()); Assert.IsEmpty(new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "b")).GetFiles()); Assert.IsTrue(new FileInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "b", "c", "file1")).Exists); Assert.IsEmpty(new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d")).GetFiles()); Assert.IsEmpty(new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d", ".git")).GetFiles()); Assert.IsEmpty(new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d", ".git", "store")).GetFiles()); }
public void TestCreatePlaceHoldersWithFollowSymbolicLinks2() { var config = MainClass.CreateConfiguration(); config.FollowSymbolicLinks = true; config.Directory = _tmpDirInfo3; var cmd = new SyncCommand(); cmd.Execute(config); Assert.AreEqual(1, _tmpDirInfo3.GetFileSystemInfos().Length); }
public void TestCreatePlaceHoldersWithFollowSymbolicLinks3() { var config = MainClass.CreateConfiguration(); config.FollowSymbolicLinks = true; config.Directory = _tmpDirInfo4; var cmd = new SyncCommand(); cmd.Execute(config); Assert.AreEqual(1, _tmpDirInfo5.GetFileSystemInfos().Length); Assert.IsTrue(new FileInfo(PathUtil.Combine(_tmpDirInfo5.FullName, "dir3", "dir4", ".emptydir")).Exists); }
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); }
public void TestCreatePlaceHolders() { var config = MainClass.CreateConfiguration(); config.Directory = _tmpDirInfo; var cmd = new SyncCommand(); cmd.Execute(config); Assert.IsTrue(new FileInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "b", "c", ".emptydir")).Exists); Assert.AreEqual(1, new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "b", "c")).GetFiles().Length); Assert.IsTrue(new FileInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d", ".emptydir")).Exists); Assert.AreEqual(1, new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d")).GetFiles().Length); Assert.AreEqual(2, new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "e")).GetFileSystemInfos().Length); Assert.IsEmpty(_tmpDirInfo.GetFiles()); Assert.IsEmpty(new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a")).GetFiles()); Assert.IsEmpty(new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "b")).GetFiles()); Assert.IsEmpty(new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d", ".git")).GetFiles()); Assert.IsEmpty(new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d", ".git", "store")).GetFiles()); Assert.IsEmpty(_tmpDirInfo2.GetFiles()); }