Exemplo n.º 1
0
        public void CheckRenamer()
        {
            var renamer = new FileRenamer();
            var file    = new Mp3File("SampleFile.mp3");

            renamer.Rename(file);

            Assert.AreEqual("NewSampleFile.mp3", file.Path);
        }
Exemplo n.º 2
0
        public void SimpleRenamer()
        {
            FileRenamer renamer = new FileRenamer();
            MP3File     file    = new MP3File("test.mp3");

            renamer.Rename(file);

            Assert.AreEqual("test_(new).mp3", file.Path);
        }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 6
0
        public void RenameWithWrongArguments()
        {
            var renamer = new FileRenamer(directory);

            renamer.Rename(new string[] { "*.mp3", "-recursive", "-wrongArgument" });
        }
Exemplo n.º 7
0
        public void RenameWithTooManyArguments()
        {
            var renamer = new FileRenamer(directory);

            renamer.Rename(new string[] { "*.mp3", "-recursive", "-toFileName", "-toTag" });
        }
Exemplo n.º 8
0
        public void RenameWithEmptyArguments()
        {
            var renamer = new FileRenamer(directory);

            renamer.Rename(new string[] { });
        }
Exemplo n.º 9
0
        public void SimpleRenamerWithNullFile()
        {
            FileRenamer renamer = new FileRenamer();

            renamer.Rename(null);
        }