public void WhenRenamingFoldersExceptionIsThrownIfDirectoryDoesNotExist() { var badDirectory = Path.Combine(_fixture.TestDirectory, Guid.NewGuid().ToString()); var folderRename = new RenameFiles(badDirectory); folderRename .Invoking(invoke => invoke.RenameAll((x) => "10")) .ShouldThrow <DirectoryNotFoundException>(); }
public void WhenRenamingFoldersThenFoldersAreRenamedBasedOnSeed() { CreateTestFolderSet(); Func <string, string> seedGenerator = (x) => { var existingX = Convert.ToInt32(x); return((++existingX).ToString()); }; var fileRename = new RenameFiles(_fixture.TestDirectory); fileRename.RenameAll(seedGenerator); _fixture.DirectoryExists("1").Should().BeTrue(); _fixture.DirectoryExists("2").Should().BeTrue(); }
private void OnRename(object sender, EventArgs e) { IRenameDiskFileAndFolders renamer = null; if (rbFiles.Checked) { renamer = new RenameFiles(_selectedPath); } else { renamer = new RenameFolders(_selectedPath); } renamer.RenameAll((x) => { var index = Convert.ToInt32(x); return((++index).ToString()); }); textBox2.Text = "Renamed in " + _selectedPath; }
static public void Main(string[] args) { if (args.Length == 1) { RenameFiles.Rename(args[0]); } else if (args.Length == 2) { string sourceDirectory = args[0]; string targetDirectory = args[1]; DirectoryInfo diSource = new DirectoryInfo(sourceDirectory); DirectoryInfo diTarget = new DirectoryInfo(targetDirectory); CopyDir.CopyAll(diSource, diTarget); } else { Console.WriteLine("Illegal arguments."); } }