public void Setup()
        {
            _series = Builder <Series>
                      .CreateNew()
                      .Build();

            _command = new MoveSeriesCommand
            {
                SeriesId        = 1,
                SourcePath      = @"C:\Test\TV\Series".AsOsAgnostic(),
                DestinationPath = @"C:\Test\TV2\Series".AsOsAgnostic()
            };

            _bulkCommand = new BulkMoveSeriesCommand
            {
                Series = new List <BulkMoveSeries>
                {
                    new BulkMoveSeries
                    {
                        SeriesId   = 1,
                        SourcePath = @"C:\Test\TV\Series".AsOsAgnostic()
                    }
                },
                DestinationRootFolder = @"C:\Test\TV2".AsOsAgnostic()
            };

            Mocker.GetMock <ISeriesService>()
            .Setup(s => s.GetSeries(It.IsAny <int>()))
            .Returns(_series);

            Mocker.GetMock <IDiskProvider>()
            .Setup(s => s.FolderExists(It.IsAny <string>()))
            .Returns(true);
        }
예제 #2
0
        public void Execute(BulkMoveSeriesCommand message)
        {
            var seriesToMove          = message.Series;
            var destinationRootFolder = message.DestinationRootFolder;

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

            for (var index = 0; index < seriesToMove.Count; index++)
            {
                var s               = seriesToMove[index];
                var series          = _seriesService.GetSeries(s.SeriesId);
                var destinationPath = Path.Combine(destinationRootFolder, _filenameBuilder.GetSeriesFolder(series));

                MoveSingleSeries(series, s.SourcePath, destinationPath, index, seriesToMove.Count);
            }

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