public void UnknownFileType() { var fakeFiles = new string[] { "readme.txt" }; var importFolderInteractor = new FakeFolderInteractor(fakeFiles); var importFolderWatcher = new ImportFolderWatcher(importFolderInteractor, null, null,null); importFolderWatcher.ProcessFiles(); Assert.AreEqual(0, importFolderInteractor.MovedFiles.Count(), "There must no moved files."); }
public void TranscodesOtherFormats() { var fakeFiles = new string[] { "test.m4a" }; var fakeMusicInfo = new MusicInfo() { Album = "Test", Artist = "Test2" }; var transcodedFile = "test.mp3"; var fakeMusicInfoReader = new FakeMusicInfoReader(fakeMusicInfo); var importFolderInteractor = new FakeFolderInteractor(fakeFiles); var fakeTranscoder = new FakeTranscoder(); var library = new MemoryLibraryRepository(); library.ClearLibrary(); var importFolderWatcher = new ImportFolderWatcher(importFolderInteractor, fakeMusicInfoReader, library, fakeTranscoder); importFolderWatcher.ProcessFiles(); var expectedLibraryPath = @"c:\temp\" + fakeMusicInfo.Artist + "\\" + fakeMusicInfo.Album + "\\" + transcodedFile; Assert.AreEqual(1, importFolderInteractor.MovedFiles.Count(), "There must one moved file"); Assert.AreEqual(transcodedFile, importFolderInteractor.MovedFiles[0].SourceFile, "The file to move must be correct."); Assert.AreEqual(expectedLibraryPath, importFolderInteractor.MovedFiles[0].DestinationFile, "The file must be moved to the correct folder."); Assert.IsTrue(importFolderInteractor.DeletedFiles.Contains(fakeFiles[0]), "The original file must be deleted."); Assert.IsTrue(importFolderInteractor.DeletedFiles.Contains(expectedLibraryPath), "The library path must be deleted."); Assert.AreEqual(2, importFolderInteractor.DeletedFiles.Count(), "There must be 2 attempted file deletes."); }
public void OneMp3file() { var fakeFiles = new string[] { "one.mp3" }; var fakeMusicInfo = new MusicInfo() { Album = "onealbum", Artist = "oneartist" }; var fakeMusicInfoReader = new FakeMusicInfoReader(fakeMusicInfo); var importFolderInteractor = new FakeFolderInteractor(fakeFiles); var library = new MemoryLibraryRepository(); library.ClearLibrary(); var importFolderWatcher = new ImportFolderWatcher(importFolderInteractor, fakeMusicInfoReader, library, null); importFolderWatcher.ProcessFiles(); var expectedLibraryPath = @"c:\temp\" + fakeMusicInfo.Artist + "\\" + fakeMusicInfo.Album + "\\" + fakeFiles[0]; Assert.AreEqual(1, importFolderInteractor.MovedFiles.Count(), "There must one moved file"); Assert.AreEqual(fakeFiles[0], importFolderInteractor.MovedFiles[0].SourceFile, "The file to move must be correct."); Assert.AreEqual(expectedLibraryPath, importFolderInteractor.MovedFiles[0].DestinationFile, "The file must be moved to the correct folder."); var libraryFiles = library.GetAllMusic(); Assert.AreEqual(1, libraryFiles.Count(), "There must be one file in the library."); Assert.AreEqual(fakeMusicInfo.Artist, libraryFiles[0].Artist, "The artist added to the library must be correct."); Assert.AreEqual(expectedLibraryPath, libraryFiles[0].FullPath, "The full path of the file in the library must be correct."); }
public void OneMp3file_NoInfo() { var fakeFiles = new string[] { "one.mp3" }; var fakeMusicInfo = new MusicInfo() { Album = "", Artist = "" }; var fakeMusicInfoReader = new FakeMusicInfoReader(fakeMusicInfo); var importFolderInteractor = new FakeFolderInteractor(fakeFiles); var importFolderWatcher = new ImportFolderWatcher(importFolderInteractor, fakeMusicInfoReader, new MemoryLibraryRepository(), null); importFolderWatcher.ProcessFiles(); var expectedLibraryPath = @"c:\temp\Unknown Artist\Unknown Album\" + fakeFiles[0]; Assert.AreEqual(1, importFolderInteractor.MovedFiles.Count(), "There must one moved file"); Assert.AreEqual(fakeFiles[0], importFolderInteractor.MovedFiles[0].SourceFile, "The file to move must be correct."); Assert.AreEqual(expectedLibraryPath, importFolderInteractor.MovedFiles[0].DestinationFile, "The file must be moved to the correct folder."); }
public void NoFiles() { var importFolderInteractor = new FakeFolderInteractor(new string[0]); var importFolderWatcher = new ImportFolderWatcher(importFolderInteractor, null, null, null); importFolderWatcher.ProcessFiles(); Assert.AreEqual(0, importFolderInteractor.MovedFiles.Count(), "There must not be any moved files"); }