mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
Converted jobs to dynamic
This commit is contained in:
parent
93402f4932
commit
a4dde81ceb
42 changed files with 166 additions and 170 deletions
|
@ -39,23 +39,23 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
|
||||
|
||||
Mocker.GetMock<DiskScanJob>()
|
||||
.Setup(j => j.Start(notification, series[0].SeriesId, 0))
|
||||
.Setup(j => j.Start(notification, new { SeriesId = series[0].SeriesId, SeasonNumber = 0}))
|
||||
.Callback(() => series[0].LastDiskSync = DateTime.Now);
|
||||
|
||||
|
||||
Mocker.GetMock<DiskScanJob>()
|
||||
.Setup(j => j.Start(notification, series[1].SeriesId, 0))
|
||||
.Setup(j => j.Start(notification, new { SeriesId = series[1].SeriesId, SeasonNumber = 0 }))
|
||||
.Callback(() => series[1].LastDiskSync = DateTime.Now);
|
||||
|
||||
Mocker.GetMock<BannerDownloadJob>()
|
||||
.Setup(j => j.Start(notification, It.IsAny<int>(), 0));
|
||||
.Setup(j => j.Start(notification, new { SeriesId = It.IsAny<int>(), SeasonNumber = 0 }));
|
||||
|
||||
Mocker.GetMock<UpdateInfoJob>()
|
||||
.Setup(j => j.Start(notification, series[0].SeriesId, 0))
|
||||
.Setup(j => j.Start(notification, new { SeriesId = series[0].SeriesId, SeasonNumber = 0 }))
|
||||
.Callback(() => series[0].LastInfoSync = DateTime.Now);
|
||||
|
||||
Mocker.GetMock<UpdateInfoJob>()
|
||||
.Setup(j => j.Start(notification, series[1].SeriesId, 0))
|
||||
.Setup(j => j.Start(notification, new { SeriesId = series[1].SeriesId, SeasonNumber = 0 }))
|
||||
.Callback(() => series[1].LastInfoSync = DateTime.Now);
|
||||
|
||||
Mocker.GetMock<SeriesProvider>()
|
||||
|
@ -68,16 +68,14 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.Setup(s => s.GetSeriesFiles(It.IsAny<int>())).Returns(new List<EpisodeFile>());
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<ImportNewSeriesJob>().Start(notification, 0, 0);
|
||||
Mocker.Resolve<ImportNewSeriesJob>().Start(notification, null);
|
||||
|
||||
//Assert
|
||||
Mocker.VerifyAllMocks();
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, new { SeriesId = series[0].SeriesId, SeasonNumber = 0 }), Times.Once());
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, new { SeriesId = series[1].SeriesId, SeasonNumber = 0 }), Times.Once());
|
||||
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, series[0].SeriesId, 0), Times.Once());
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, series[1].SeriesId, 0), Times.Once());
|
||||
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, series[0].SeriesId, 0), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, series[1].SeriesId, 0), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, new { SeriesId = series[0].SeriesId, SeasonNumber = 0 }), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, new { SeriesId = series[1].SeriesId, SeasonNumber = 0 }), Times.Once());
|
||||
|
||||
}
|
||||
|
||||
|
@ -103,19 +101,19 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.Returns(series);
|
||||
|
||||
Mocker.GetMock<UpdateInfoJob>()
|
||||
.Setup(j => j.Start(notification, series[0].SeriesId, 0))
|
||||
.Setup(j => j.Start(notification, new { SeriesId = series[0].SeriesId, SeasonNumber = 0 }))
|
||||
.Callback(() => series[0].LastInfoSync = DateTime.Now);
|
||||
|
||||
Mocker.GetMock<UpdateInfoJob>()
|
||||
.Setup(j => j.Start(notification, series[1].SeriesId, 0))
|
||||
.Setup(j => j.Start(notification, new { SeriesId = series[1].SeriesId, SeasonNumber = 0 }))
|
||||
.Throws(new InvalidOperationException());
|
||||
|
||||
Mocker.GetMock<DiskScanJob>()
|
||||
.Setup(j => j.Start(notification, series[0].SeriesId, 0))
|
||||
.Setup(j => j.Start(notification, new { SeriesId = series[0].SeriesId, SeasonNumber = 0 }))
|
||||
.Callback(() => series[0].LastDiskSync = DateTime.Now);
|
||||
|
||||
Mocker.GetMock<BannerDownloadJob>()
|
||||
.Setup(j => j.Start(notification, series[0].SeriesId, 0));
|
||||
.Setup(j => j.Start(notification, new { SeriesId = series[0].SeriesId, SeasonNumber = 0 }));
|
||||
|
||||
Mocker.GetMock<SeriesProvider>()
|
||||
.Setup(s => s.GetSeries(series[0].SeriesId)).Returns(series[0]);
|
||||
|
@ -124,15 +122,15 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.Setup(s => s.GetSeriesFiles(It.IsAny<int>())).Returns(new List<EpisodeFile>());
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<ImportNewSeriesJob>().Start(notification, 0, 0);
|
||||
Mocker.Resolve<ImportNewSeriesJob>().Start(notification, null);
|
||||
|
||||
//Assert
|
||||
Mocker.VerifyAllMocks();
|
||||
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, series[0].SeriesId, 0), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, series[1].SeriesId, 0), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, new { SeriesId = series[0].SeriesId, SeasonNumber = 0 }), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, new { SeriesId = series[1].SeriesId, SeasonNumber = 0 }), Times.Once());
|
||||
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, series[0].SeriesId, 0), Times.Once());
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, new { SeriesId = series[0].SeriesId, SeasonNumber = 0}), Times.Once());
|
||||
|
||||
ExceptionVerification.ExpectedErrors(1);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue