Ejemplo n.º 1
0
        public void ExecuteToTag()
        {
            MockFileManager fileSystem = new MockFileManager();

            fileSystem.AddFile("Bon Jovi - It's my life.mp3",
                               new MockMp3File("Bon Jovi - It's my life.mp3", fileSystem));
            fileSystem.AddFile("Imagine Dragons - Believer.mp3",
                               new MockMp3File("Imagine Dragons - Believer.mp3", fileSystem));

            RenamerArguments renamerArguments = new RenamerArguments
            {
                IsRecursive = false,
                Action      = AllowedActions.ToTag,
                Mask        = "*.mp3"
            };

            Processor processor = new Processor(renamerArguments, fileSystem);

            processor.Process();

            Assert.AreEqual("Bon Jovi", fileSystem.Files["Bon Jovi - It's my life.mp3"].Artist);
            Assert.AreEqual("It's my life", fileSystem.Files["Bon Jovi - It's my life.mp3"].Title);

            Assert.AreEqual("Imagine Dragons", fileSystem.Files["Imagine Dragons - Believer.mp3"].Artist);
            Assert.AreEqual("Believer", fileSystem.Files["Imagine Dragons - Believer.mp3"].Title);

            Assert.AreEqual(2, fileSystem.Files.Count);
        }
Ejemplo n.º 2
0
        public void ExecuteToFileName()
        {
            MockFileManager fileSystem = new MockFileManager();

            fileSystem.AddFile("file1.mp3",
                               new MockMp3File("file1.mp3", fileSystem)
            {
                Artist = "Bon Jovi", Title = "It's my life"
            });
            fileSystem.AddFile("file2.mp3",
                               new MockMp3File("file2.mp3", fileSystem)
            {
                Artist = "Imagine Dragons", Title = "Believer"
            });

            RenamerArguments renamerArguments = new RenamerArguments
            {
                IsRecursive = false,
                Action      = AllowedActions.ToFileName,
                Mask        = "*.mp3"
            };

            Processor processor = new Processor(renamerArguments, fileSystem);

            processor.Process();

            Assert.IsTrue(fileSystem.Exist("\\Bon Jovi - It's my life.mp3"));
            Assert.IsTrue(fileSystem.Exist("\\Imagine Dragons - Believer.mp3"));

            Assert.AreEqual(2, fileSystem.Files.Count);
        }
Ejemplo n.º 3
0
        public void FileNameToTagActionTest()
        {
            MockFileManager fileManager = new MockFileManager();

            IAction fileNameToTagAction = new FileNameToTagAction();

            string   title   = "Songbyauthor";
            string   artist  = "Author";
            IMP3File mp3File = new MockMp3File(artist + " - " + title + ".mp3", fileManager);

            fileManager.AddFile(artist + " - " + title + ".mp3", mp3File);

            fileNameToTagAction.Process(mp3File);

            Assert.AreEqual(title, mp3File.Title);
            Assert.AreEqual(artist, mp3File.Artist);
        }
Ejemplo n.º 4
0
        public void TagToFileNameActionTest()
        {
            MockFileManager fileManager = new MockFileManager();

            IAction tagToFileNameAction = new TagToFileNameAction();

            IMP3File mp3File = new MockMp3File("test.mp3", fileManager);
            string   title   = "Songbyauthor";
            string   artist  = "Author";

            mp3File.Title  = title;
            mp3File.Artist = artist;
            fileManager.AddFile("test.mp3", mp3File);

            tagToFileNameAction.Process(mp3File);

            Assert.IsTrue(fileManager.Exist("\\" + artist + " - " + title + ".mp3"));
        }