public void TestCleanPlaceHolders() { var config = MainClass.CreateConfiguration(); config.Directory = _tmpDirInfo; var cmd = new CleanCommand(); cmd.Execute(config); Assert.IsTrue(new FileInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "file1")).Exists); Assert.IsTrue(new FileInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "b", "file2")).Exists); Assert.IsTrue(new FileInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d", "file3")).Exists); Assert.IsTrue(new FileInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d", ".git", ".emptydir")).Exists); Assert.IsEmpty(_tmpDirInfo.GetFiles()); Assert.AreEqual(1, new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a")).GetFiles().Length); Assert.AreEqual(1, new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "b")).GetFiles().Length); Assert.IsEmpty(new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "b", "c")).GetFiles()); Assert.AreEqual(1, new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d")).GetFiles().Length); Assert.AreEqual(1, new DirectoryInfo(PathUtil.Combine(_tmpDirInfo.FullName, "a", "d", ".git")).GetFiles().Length); }
public static void Main(string[] args) { args = GetDecoratedArgs(args); try { var config = ParseConfiguration(args); ICommand cmd; if (config.Help) { cmd = new HelpCommand { Writer = Console.Out } } ; else if (config.CleanUp) { cmd = new CleanCommand(); } else if (config.Purge) { cmd = new PurgeCommand(); } else { cmd = new SyncCommand(); } cmd.Execute(config); } catch (Exception ex) { Logger.Log(ex); } }