Пример #1
0
        public void Setup()
        {
            _artist = Builder <Artist>
                      .CreateNew()
                      .Build();

            _command = new MoveArtistCommand
            {
                ArtistId        = 1,
                SourcePath      = @"C:\Test\Music\Artist".AsOsAgnostic(),
                DestinationPath = @"C:\Test\Music2\Artist".AsOsAgnostic()
            };

            _bulkCommand = new BulkMoveArtistCommand
            {
                Artist = new List <BulkMoveArtist>
                {
                    new BulkMoveArtist
                    {
                        ArtistId   = 1,
                        SourcePath = @"C:\Test\Music\Artist".AsOsAgnostic()
                    }
                },
                DestinationRootFolder = @"C:\Test\Music2".AsOsAgnostic()
            };

            Mocker.GetMock <IArtistService>()
            .Setup(s => s.GetArtist(It.IsAny <int>()))
            .Returns(_artist);

            Mocker.GetMock <IDiskProvider>()
            .Setup(s => s.FolderExists(It.IsAny <string>()))
            .Returns(true);
        }
Пример #2
0
        public void Execute(BulkMoveArtistCommand message)
        {
            var artistToMove          = message.Artist;
            var destinationRootFolder = message.DestinationRootFolder;

            _logger.ProgressInfo("Moving {0} artist to '{1}'", artistToMove.Count, destinationRootFolder);

            for (var index = 0; index < artistToMove.Count; index++)
            {
                var s               = artistToMove[index];
                var artist          = _artistService.GetArtist(s.ArtistId);
                var destinationPath = Path.Combine(destinationRootFolder, _filenameBuilder.GetArtistFolder(artist));

                MoveSingleArtist(artist, s.SourcePath, destinationPath, index, artistToMove.Count);
            }

            _logger.ProgressInfo("Finished moving {0} artist to '{1}'", artistToMove.Count, destinationRootFolder);
        }