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();
        }
Пример #2
0
        public Mp3LibrarySorter(IFileSystem fileSystem, string startDirectory, IMp3TagsHierarchy mp3TagsHierarchy, IMp3FileReader mp3FileReader)
        {
            _fileSystem = fileSystem;
            _startDirectory = startDirectory;
            _mp3TagsHierarchy = mp3TagsHierarchy;
            _mp3FileReader = mp3FileReader;

            var files = _fileSystem.GetAllMp3Files(startDirectory);
            _mp3Files = _mp3FileReader.RetrieveTagsFromMp3Files(files);
            foreach (var mp3Representation in _mp3Files)
            {
                _mp3TagsHierarchy.AddInformation(mp3Representation);
            }
        }