mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
test clean up.
This commit is contained in:
@@ -44,10 +44,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
StartUpdate();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true));
|
||||
}
|
||||
|
||||
@@ -56,10 +56,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
StartUpdate();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true), Times.Never());
|
||||
}
|
||||
|
||||
@@ -69,10 +69,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
|
||||
|
||||
//Act
|
||||
|
||||
StartUpdate();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<HttpProvider>().Verify(
|
||||
c => c.DownloadFile(updatePackage.Url, updateArchive));
|
||||
}
|
||||
@@ -82,10 +82,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
|
||||
|
||||
//Act
|
||||
|
||||
StartUpdate();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<ArchiveProvider>().Verify(
|
||||
c => c.ExtractArchive(updateArchive, SANDBOX_FOLDER));
|
||||
}
|
||||
@@ -95,10 +95,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
var updateClientFolder = Mocker.GetMock<EnvironmentProvider>().Object.GetUpdateClientFolder();
|
||||
|
||||
//Act
|
||||
|
||||
StartUpdate();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskProvider>().Verify(
|
||||
c => c.MoveDirectory(updateClientFolder, SANDBOX_FOLDER));
|
||||
}
|
||||
@@ -106,16 +106,16 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void should_start_update_client()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var updateClientPath = Mocker.GetMock<EnvironmentProvider>().Object.GetUpdateClientExePath();
|
||||
|
||||
Mocker.GetMock<EnvironmentProvider>()
|
||||
.SetupGet(c => c.NzbDroneProcessIdFromEnviroment).Returns(12);
|
||||
|
||||
//Act
|
||||
|
||||
StartUpdate();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<ProcessProvider>().Verify(
|
||||
c => c.Start(It.Is<ProcessStartInfo>(p =>
|
||||
p.FileName == updateClientPath &&
|
||||
@@ -143,7 +143,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
var updateSubFolder = new DirectoryInfo(Mocker.GetMock<EnvironmentProvider>().Object.GetUpdateSandboxFolder());
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
updateSubFolder.Exists.Should().BeFalse();
|
||||
|
||||
Mocker.Resolve<HttpProvider>();
|
||||
@@ -151,7 +151,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.Resolve<ArchiveProvider>();
|
||||
StartUpdate();
|
||||
updateSubFolder.Refresh();
|
||||
//Assert
|
||||
|
||||
|
||||
updateSubFolder.Exists.Should().BeTrue();
|
||||
updateSubFolder.GetDirectories("nzbdrone").Should().HaveCount(1);
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void no_missing_epsiodes_should_not_trigger_any_search()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var notification = new ProgressNotification("Backlog Search Job Test");
|
||||
|
||||
var episodes = new List<Episode>();
|
||||
@@ -39,10 +39,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
Subject.Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, new { SeriesId = It.IsAny<int>(), SeasonNumber = It.IsAny<int>() }),
|
||||
Times.Never());
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void individual_missing_episode()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var notification = new ProgressNotification("Backlog Search Job Test");
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
@@ -74,10 +74,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<EpisodeSearchJob>()
|
||||
.Setup(s => s.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") == 1)));
|
||||
|
||||
//Act
|
||||
|
||||
Subject.Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)),
|
||||
Times.Once());
|
||||
}
|
||||
@@ -85,7 +85,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void individual_missing_episodes_only()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var notification = new ProgressNotification("Backlog Search Job Test");
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
@@ -103,10 +103,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
Subject.Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)),
|
||||
Times.Exactly(episodes.Count));
|
||||
}
|
||||
@@ -114,7 +114,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void series_season_missing_episodes_only_mismatch_count()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var notification = new ProgressNotification("Backlog Search Job Test");
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
@@ -136,10 +136,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.GetEpisodeNumbersBySeason(1, 1)).Returns(new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
|
||||
|
||||
//Act
|
||||
|
||||
Subject.Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)),
|
||||
Times.Exactly(episodes.Count));
|
||||
}
|
||||
@@ -147,7 +147,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void series_season_missing_episodes_only()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var notification = new ProgressNotification("Backlog Search Job Test");
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
@@ -170,10 +170,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.GetEpisodeNumbersBySeason(1, 1)).Returns(episodes.Select(e => e.EpisodeNumber).ToList());
|
||||
|
||||
//Act
|
||||
|
||||
Subject.Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") >= 0 &&
|
||||
d.GetPropertyValue<int>("SeasonNumber") >= 0)),
|
||||
Times.Once());
|
||||
@@ -182,7 +182,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void multiple_missing_episodes()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var notification = new ProgressNotification("Backlog Search Job Test");
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
@@ -212,10 +212,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.GetEpisodeNumbersBySeason(1, 1)).Returns(new List<int> { 1, 2, 3, 4, 5 });
|
||||
|
||||
//Act
|
||||
|
||||
Subject.Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") >= 0 &&
|
||||
d.GetPropertyValue<int>("SeasonNumber") >= 0)),
|
||||
Times.Once());
|
||||
@@ -227,7 +227,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void GetMissingForEnabledSeries_should_only_return_episodes_for_monitored_series()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(2)
|
||||
.TheFirst(1)
|
||||
.With(s => s.Monitored = false)
|
||||
@@ -250,10 +250,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Subject.GetMissingForEnabledSeries();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result.Should().Contain(s => s.Series.Monitored);
|
||||
result.Should().NotContain(s => !s.Series.Monitored);
|
||||
@@ -262,7 +262,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void GetMissingForEnabledSeries_should_only_return_explicity_enabled_series_when_backlog_searching_is_ignored()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(3)
|
||||
.TheFirst(1)
|
||||
.With(s => s.Monitored = true)
|
||||
@@ -289,10 +289,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Subject.GetMissingForEnabledSeries();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result.Should().Contain(s => s.Series.BacklogSetting == BacklogSettingType.Enable);
|
||||
result.Should().NotContain(s => s.Series.BacklogSetting == BacklogSettingType.Disable);
|
||||
@@ -302,7 +302,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void GetMissingForEnabledSeries_should_return_explicity_enabled_and_inherit_series_when_backlog_searching_is_enabled()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(3)
|
||||
.TheFirst(1)
|
||||
.With(s => s.Monitored = true)
|
||||
@@ -329,10 +329,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Subject.GetMissingForEnabledSeries();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result.Should().Contain(s => s.Series.BacklogSetting == BacklogSettingType.Enable);
|
||||
result.Should().NotContain(s => s.Series.BacklogSetting == BacklogSettingType.Disable);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -21,7 +21,7 @@ using System.Linq;
|
||||
namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class DiskScanJobTest : CoreTest
|
||||
{
|
||||
[Test]
|
||||
@@ -39,10 +39,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
.Setup(p => p.Scan(series))
|
||||
.Returns(new List<EpisodeFile>());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<DiskScanJob>().Start(new ProgressNotification("Test"), new { SeriesId = series.Id });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -20,7 +20,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
||||
namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class ImportNewSeriesJobTest : CoreTest
|
||||
{
|
||||
[Test]
|
||||
@@ -69,10 +69,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(s => s.GetFilesBySeries(It.IsAny<int>())).Returns(new List<EpisodeFile>());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<ImportNewSeriesJob>().Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)), Times.Once());
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].Id)), Times.Once());
|
||||
|
||||
@@ -123,10 +123,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<XemUpdateJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)));
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<ImportNewSeriesJob>().Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].Id)), Times.Once());
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
@@ -37,16 +37,16 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void no_missing_epsiodes_should_not_trigger_any_search()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var episodes = new List<Episode>();
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<RecentBacklogSearchJob>().Start(MockNotification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(MockNotification, new { EpisodeId = It.IsAny<int>() }),
|
||||
Times.Never());
|
||||
}
|
||||
@@ -61,7 +61,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
.With(s => s.BacklogSetting = BacklogSettingType.Enable)
|
||||
.Build();
|
||||
|
||||
//Setup
|
||||
|
||||
var episodes = Builder<Episode>.CreateListOfSize(50)
|
||||
.All()
|
||||
.With(e => e.Series = series)
|
||||
@@ -92,10 +92,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
|
||||
Mocker.GetMock<EpisodeSearchJob>().Setup(c => c.Start(It.IsAny<ProgressNotification>(), It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)));
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<RecentBacklogSearchJob>().Start(MockNotification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(It.IsAny<ProgressNotification>(), It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)),
|
||||
Times.Exactly(40));
|
||||
}
|
||||
@@ -103,7 +103,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void GetMissingForEnabledSeries_should_only_return_episodes_for_monitored_series()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(2)
|
||||
.TheFirst(1)
|
||||
.With(s => s.Monitored = false)
|
||||
@@ -126,10 +126,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<RecentBacklogSearchJob>().GetMissingForEnabledSeries();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result.Should().Contain(s => s.Series.Monitored);
|
||||
result.Should().NotContain(s => !s.Series.Monitored);
|
||||
@@ -138,7 +138,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void GetMissingForEnabledSeries_should_only_return_explicity_enabled_series_when_backlog_searching_is_ignored()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(3)
|
||||
.TheFirst(1)
|
||||
.With(s => s.Monitored = true)
|
||||
@@ -165,10 +165,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<RecentBacklogSearchJob>().GetMissingForEnabledSeries();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result.Should().Contain(s => s.Series.BacklogSetting == BacklogSettingType.Enable);
|
||||
result.Should().NotContain(s => s.Series.BacklogSetting == BacklogSettingType.Disable);
|
||||
@@ -178,7 +178,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void GetMissingForEnabledSeries_should_return_explicity_enabled_and_inherit_series_when_backlog_searching_is_enabled()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(3)
|
||||
.TheFirst(1)
|
||||
.With(s => s.Monitored = true)
|
||||
@@ -205,10 +205,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<RecentBacklogSearchJob>().GetMissingForEnabledSeries();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result.Should().Contain(s => s.Series.BacklogSetting == BacklogSettingType.Enable);
|
||||
result.Should().NotContain(s => s.Series.BacklogSetting == BacklogSettingType.Disable);
|
||||
|
||||
@@ -14,7 +14,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
||||
namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class RssSyncJobTest : CoreTest
|
||||
{
|
||||
public void WithMinutes(int minutes)
|
||||
|
||||
@@ -16,7 +16,7 @@ using NzbDrone.Test.Common;
|
||||
namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class SeasonSearchJobTest : CoreTest
|
||||
{
|
||||
private List<Episode> _episodes;
|
||||
@@ -47,10 +47,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
.Setup(c => c.PartialSeasonSearch(notification, 1, 1))
|
||||
.Returns(_episodes.Select(e => e.EpisodeNumber).ToList());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SeasonSearchJob>().Start(notification, new { SeriesId = 1, SeasonNumber = 1 });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Mocker.GetMock<SearchProvider>().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Once());
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, new { EpisodeId = It.IsAny<int>() }), Times.Never());
|
||||
@@ -63,10 +63,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
.Setup(c => c.PartialSeasonSearch(notification, 1, 1))
|
||||
.Returns(new List<int>());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SeasonSearchJob>().Start(notification, new { SeriesId = 1, SeasonNumber = 1 });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<SearchProvider>().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Once());
|
||||
}
|
||||
|
||||
@@ -91,10 +91,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
.Returns(new List<int>{1});
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SeasonSearchJob>().Start(notification, new { SeriesId = 1, SeasonNumber = 1 });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Mocker.GetMock<SearchProvider>().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Once());
|
||||
}
|
||||
@@ -105,10 +105,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<SearchProvider>()
|
||||
.Setup(c => c.PartialSeasonSearch(notification, 1, 0)).Returns(new List<int>());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SeasonSearchJob>().Start(notification, new { SeriesId = 1, SeasonNumber = 0 });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<SearchProvider>().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Never());
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, new { EpisodeId = It.IsAny<int>() }), Times.Never());
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
||||
namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class SeriesSearchJobTest : CoreTest
|
||||
{
|
||||
[Test]
|
||||
@@ -35,10 +35,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<SeasonSearchJob>()
|
||||
.Setup(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == 1 && d.GetPropertyValue<int>("SeasonNumber") >= 0))).Verifiable();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SeriesSearchJob>().Start(notification, new { SeriesId = 1 });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == 1 && d.GetPropertyValue<int>("SeasonNumber") >= 0)),
|
||||
Times.Exactly(seasons.Count));
|
||||
@@ -56,10 +56,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.GetMock<ISeasonRepository>()
|
||||
.Setup(c => c.GetSeasonNumbers(1)).Returns(seasons);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SeriesSearchJob>().Start(notification, new { SeriesId = 1 });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, new { SeriesId = 1, SeasonNumber = It.IsAny<int>() }),
|
||||
Times.Never());
|
||||
|
||||
Reference in New Issue
Block a user