public void Setup() { _mockMp3Representation = MockRepository.GenerateStub<IMp3Representation>(); _mockMp3Representation.AlbumName = SomeAlbumName; _mockMp3Representation.ArtistName = SomeArtistName; _mockMp3Representation.FileName = SomeFileName; _mockFileSystem = MockRepository.GenerateStub<IFileSystem>(); _mockFileSystem.Stub(system => system.GetAllMp3Files(SomeStartDirectory)).Return(new List<string> { SomeFileName }); _mockMp3TagHierarchy = MockRepository.GenerateStub<IMp3TagsHierarchy>(); _mockMp3TagHierarchy.Stub(hierarchy => hierarchy.Artists).Return(new List<string> {SomeArtistName}); _mockMp3TagHierarchy.Stub(tagsHierarchy => tagsHierarchy.GetAlbumsForArtist(SomeArtistName)).Return( new List<string> {SomeAlbumName}); _mockMp3TagHierarchy.Stub( mp3TagsHierarchy => mp3TagsHierarchy.GetSongsForAlbumOfArtist(SomeAlbumName, SomeArtistName)).Return( new List<string> {SomeFileName}); _mockMp3FileReader = MockRepository.GenerateStub<IMp3FileReader>(); _mockMp3FileReader.Stub(reader => reader.RetrieveTagsFromMp3Files(new List<string> {SomeFileName})).Return( new List<IMp3Representation> { new Mp3Representation {AlbumName = SomeAlbumName, ArtistName = SomeArtistName, FileName = SomeFileName} }); _mp3LibrarySorter = new Mp3LibrarySorter.Mp3LibrarySorter(_mockFileSystem, SomeStartDirectory, _mockMp3TagHierarchy, _mockMp3FileReader); _mp3LibrarySorter.CreateFoldersForArtists(); }
public void AddInformation(IMp3Representation mp3Representation) { var artist = mp3Representation.ArtistName; var albumName = mp3Representation.AlbumName; var song = mp3Representation.FileName; if (_artistAlbumSongs.ContainsKey(artist)) { var albumSongs = _artistAlbumSongs[artist]; if (albumSongs.ContainsKey(albumName)) { albumSongs[albumName].Add(song); } else { albumSongs[albumName] = new List<string>{song}; } } else { _artistAlbumSongs[artist] = new Dictionary<string, List<string>>(); _artistAlbumSongs[artist][albumName] = new List<string>{song}; } }