public void CheckRenamer() { var renamer = new FileRenamer(); var file = new Mp3File("SampleFile.mp3"); renamer.Rename(file); Assert.AreEqual("NewSampleFile.mp3", file.Path); }
public void SimpleRenamer() { FileRenamer renamer = new FileRenamer(); MP3File file = new MP3File("test.mp3"); renamer.Rename(file); Assert.AreEqual("test_(new).mp3", file.Path); }
public void Undo(ObservableCollection <MyFile> currentFiles, CommittedChange request) { // Perform rename fileRenamer.Rename(request.Directory, request.NewFileNames, request.OldFileNames); // Update current files currentFiles.Clear(); foreach (var oldFileName in request.OldFileNames) { var oldFile = fileInfoService.GetMyFile(Path.Combine(request.Directory, oldFileName)); currentFiles.Add(oldFile); } }
public CommittedChange Rename(string directory, ObservableCollection <MyFile> currentFiles, BasicRequestData data, BasicRequestMode mode) { var currentFileNames = currentFiles.Select(file => file.Name).ToList(); // Process request var newFileNames = GetNewFileNames(directory, currentFiles, data, mode); // Perform rename renamer.Rename(directory, currentFiles.Select(file => file.Name), newFileNames); // Update current files currentFiles.Clear(); foreach (var newFileName in newFileNames) { var newFile = fileInfoService.GetMyFile(Path.Combine(directory, newFileName)); currentFiles.Add(newFile); } // ReturUserControl1.xamln committed change var change = new CommittedChange(directory, currentFileNames, newFileNames, data.GetCopy(), mode.GetCopy()); return(change); }
public void RemoveFileEndingsTests() { var result = Array.ConvertAll(mocFilesFunnyEndings, f => _renamer.Rename(f)); CollectionAssert.AreEquivalent(mocFiles, result); }
public void RenameWithWrongArguments() { var renamer = new FileRenamer(directory); renamer.Rename(new string[] { "*.mp3", "-recursive", "-wrongArgument" }); }
public void RenameWithTooManyArguments() { var renamer = new FileRenamer(directory); renamer.Rename(new string[] { "*.mp3", "-recursive", "-toFileName", "-toTag" }); }
public void RenameWithEmptyArguments() { var renamer = new FileRenamer(directory); renamer.Rename(new string[] { }); }
public void SimpleRenamerWithNullFile() { FileRenamer renamer = new FileRenamer(); renamer.Rename(null); }