public void ExtractTagsFromName() { string[] files = { @"Bullet For My Valentine - Cries in Vain.mp3", @"Ciao Adios - Anne-Mari.mp3" }; List <string[]> expectedValues = new List <string[]> { new[] { "Bullet For My Valentine", "Cries in Vain" }, new[] { "Ciao Adios", "Anne-Mari" } }; IActionStrategy tagAction = new TagAction(); int i = 0; foreach (string file in files) { TestableMp3File mp3File = new TestableMp3File(file); tagAction.Process(mp3File); Assert.AreEqual(expectedValues[i][0], mp3File.Artist); Assert.AreEqual(expectedValues[i][1], mp3File.Title); Assert.AreEqual(true, mp3File.Saved); i++; } }
public void ExecuteWithToTagAction() { List <string[]> expectedValues = new List <string[]> { new[] { "Bullet For My Valentine", "Cries in Vain" }, new[] { "Ciao Adios", "Anne-Mari" } }; MockFileSystem mockFileSystem = new MockFileSystem(); mockFileSystem.Add("Bullet For My Valentine - Cries in Vain.mp3", new TestableMp3File("Bullet For My Valentine - Cries in Vain.mp3", mockFileSystem)); mockFileSystem.Add("Ciao Adios - Anne-Mari.mp3", new TestableMp3File("Ciao Adios - Anne-Mari.mp3", mockFileSystem)); Args args = new Args("*.*", true, ProgramAction.ToTag); Processor processor = new Processor(args, mockFileSystem); processor.Execute(); int i = 0; foreach (var audioFile in mockFileSystem.GetAudioFilesFromCurrentDirectory("", false)) { TestableMp3File mp3File = audioFile as TestableMp3File; Assert.AreEqual(expectedValues[i][0], mp3File.Artist); Assert.AreEqual(expectedValues[i][1], mp3File.Title); Assert.AreEqual(true, mp3File.Saved); i++; } }
public void MakeTags() { var file = new TestableMp3File(@"Led Zeppelin - Kashmir.mp3"); file.MakeTags(); Assert.AreEqual("Led Zeppelin", file.Artist); Assert.AreEqual("Kashmir", file.Title); }
public void MakeFilename() { var file = new TestableMp3File("Kashmir.mp3"); file.Artist = "Led Zeppelin"; file.Title = "Kashmir"; file.MakeFilename(); Assert.AreEqual("Led Zeppelin - Kashmir", Path.GetFileNameWithoutExtension(file.path)); }
public void RenameFiles() { MockFileSystem fileSystem = new MockFileSystem(new[] { @"Bullet For My Valentine - Cries in Vain.mp3", @"Anne-Marie - Ciao Adios.mp3" }); IActionStrategy fileNameAction = new FileNameAction(); foreach (string file in fileSystem.AllFiles) { AudioFile mp3File = new TestableMp3File(file, fileSystem); string artist = GetRandomString(); string title = GetRandomString(); mp3File.Artist = artist; mp3File.Title = title; fileNameAction.Process(mp3File); Assert.AreEqual(true, fileSystem.Exists($@"{artist} - {title}.mp3")); } }