|
|
|
@ -12,6 +12,7 @@ using NzbDrone.Core.Providers;
|
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
using NzbDrone.Test.Common;
|
|
|
|
|
using NzbDrone.Test.Common.AutoMoq;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.JobTests
|
|
|
|
@ -39,13 +40,13 @@ namespace NzbDrone.Core.Test.JobTests
|
|
|
|
|
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
Mocker.Resolve<BacklogSearchJob>().Start(notification, 0, 0);
|
|
|
|
|
Mocker.Resolve<BacklogSearchJob>().Start(notification, null);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), It.IsAny<int>()),
|
|
|
|
|
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, new { SeriesId = It.IsAny<int>(), SeasonNumber = It.IsAny<int>() }),
|
|
|
|
|
Times.Never());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), 0),
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, new { SeriesId = It.IsAny<int>(), SeasonNumber = 0 }),
|
|
|
|
|
Times.Never());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -65,23 +66,19 @@ namespace NzbDrone.Core.Test.JobTests
|
|
|
|
|
.With(e => e.Series = series)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
WithStrictMocker();
|
|
|
|
|
WithEnableBacklogSearching();
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeProvider>()
|
|
|
|
|
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>()
|
|
|
|
|
.Setup(s => s.Start(notification, It.IsAny<int>(), 0)).Verifiable();
|
|
|
|
|
.Setup(s => s.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") == 1)));
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
Mocker.Resolve<BacklogSearchJob>().Start(notification, 0, 0);
|
|
|
|
|
Mocker.Resolve<BacklogSearchJob>().Start(notification, null);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), It.IsAny<int>()),
|
|
|
|
|
Times.Never());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), 0),
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)),
|
|
|
|
|
Times.Once());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -101,23 +98,16 @@ namespace NzbDrone.Core.Test.JobTests
|
|
|
|
|
.With(e => e.Series = series)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
WithStrictMocker();
|
|
|
|
|
WithEnableBacklogSearching();
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeProvider>()
|
|
|
|
|
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>()
|
|
|
|
|
.Setup(s => s.Start(notification, It.IsAny<int>(), 0)).Verifiable();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
Mocker.Resolve<BacklogSearchJob>().Start(notification, 0, 0);
|
|
|
|
|
Mocker.Resolve<BacklogSearchJob>().Start(notification, null);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), It.IsAny<int>()),
|
|
|
|
|
Times.Never());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), 0),
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)),
|
|
|
|
|
Times.Exactly(episodes.Count));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -138,27 +128,20 @@ namespace NzbDrone.Core.Test.JobTests
|
|
|
|
|
.With(e => e.SeasonNumber = 1)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
WithStrictMocker();
|
|
|
|
|
WithEnableBacklogSearching();
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeProvider>()
|
|
|
|
|
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>()
|
|
|
|
|
.Setup(s => s.Start(notification, It.IsAny<int>(), 0)).Verifiable();
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeProvider>()
|
|
|
|
|
.Setup(s => s.GetEpisodeNumbersBySeason(1, 1)).Returns(new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
Mocker.Resolve<BacklogSearchJob>().Start(notification, 0, 0);
|
|
|
|
|
Mocker.Resolve<BacklogSearchJob>().Start(notification, null);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), It.IsAny<int>()),
|
|
|
|
|
Times.Never());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), 0),
|
|
|
|
|
Times.Exactly(episodes.Count));
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)),
|
|
|
|
|
Times.Exactly(episodes.Count));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
@ -179,27 +162,21 @@ namespace NzbDrone.Core.Test.JobTests
|
|
|
|
|
.With(e => e.SeasonNumber = 1)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
WithStrictMocker();
|
|
|
|
|
WithEnableBacklogSearching();
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeProvider>()
|
|
|
|
|
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<SeasonSearchJob>()
|
|
|
|
|
.Setup(s => s.Start(notification, It.IsAny<int>(), It.IsAny<int>())).Verifiable();
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeProvider>()
|
|
|
|
|
.Setup(s => s.GetEpisodeNumbersBySeason(1, 1)).Returns(episodes.Select(e => e.EpisodeNumber).ToList());
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
Mocker.Resolve<BacklogSearchJob>().Start(notification, 0, 0);
|
|
|
|
|
Mocker.Resolve<BacklogSearchJob>().Start(notification, null);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), It.IsAny<int>()),
|
|
|
|
|
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") >= 0 &&
|
|
|
|
|
d.GetPropertyValue<int>("SeasonNumber") >= 0)),
|
|
|
|
|
Times.Once());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), 0),
|
|
|
|
|
Times.Never());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
@ -227,30 +204,24 @@ namespace NzbDrone.Core.Test.JobTests
|
|
|
|
|
.With(e => e.Series = series2)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
WithStrictMocker();
|
|
|
|
|
WithEnableBacklogSearching();
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeProvider>()
|
|
|
|
|
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<SeasonSearchJob>()
|
|
|
|
|
.Setup(s => s.Start(notification, It.IsAny<int>(), It.IsAny<int>())).Verifiable();
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>()
|
|
|
|
|
.Setup(s => s.Start(notification, It.IsAny<int>(), 0)).Verifiable();
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeProvider>()
|
|
|
|
|
.Setup(s => s.GetEpisodeNumbersBySeason(1, 1)).Returns(new List<int> { 1, 2, 3, 4, 5 });
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
Mocker.Resolve<BacklogSearchJob>().Start(notification, 0, 0);
|
|
|
|
|
Mocker.Resolve<BacklogSearchJob>().Start(notification, null);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), It.IsAny<int>()),
|
|
|
|
|
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") >= 0 &&
|
|
|
|
|
d.GetPropertyValue<int>("SeasonNumber") >= 0)),
|
|
|
|
|
Times.Once());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), 0),
|
|
|
|
|
Times.Exactly(5));
|
|
|
|
|
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)),
|
|
|
|
|
Times.Exactly(5));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|