1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 07:22:35 +01:00

fixed more tests.

This commit is contained in:
kay.one 2013-02-24 11:57:33 -08:00
parent a98d792c0d
commit 9931bab998
51 changed files with 184 additions and 169 deletions

View File

@ -66,9 +66,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
firstQuality = new QualityModel(QualityTypes.Bluray1080p, true); firstQuality = new QualityModel(QualityTypes.Bluray1080p, true);
secondQuality = new QualityModel(QualityTypes.Bluray1080p, true); secondQuality = new QualityModel(QualityTypes.Bluray1080p, true);
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.SeriesId, 12, 3)).Returns(firstQuality); Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 3)).Returns(firstQuality);
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.SeriesId, 12, 4)).Returns(secondQuality); Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 4)).Returns(secondQuality);
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.SeriesId, 12, 5)).Returns<QualityModel>(null); Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 5)).Returns<QualityModel>(null);
} }
private void WithFirstReportUpgradable() private void WithFirstReportUpgradable()
@ -124,7 +124,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
parseResultSingle.Quality = new QualityModel(QualityTypes.WEBDL1080p, false); parseResultSingle.Quality = new QualityModel(QualityTypes.WEBDL1080p, false);
firstQuality = new QualityModel(QualityTypes.WEBDL1080p, false); firstQuality = new QualityModel(QualityTypes.WEBDL1080p, false);
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.SeriesId, 12, 3)).Returns(firstQuality); Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 3)).Returns(firstQuality);
_upgradeHistory.IsSatisfiedBy(parseResultSingle).Should().BeFalse(); _upgradeHistory.IsSatisfiedBy(parseResultSingle).Should().BeFalse();
} }

View File

@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.Build(); .Build();
_episode = Builder<Episode>.CreateNew() _episode = Builder<Episode>.CreateNew()
.With(e => e.SeriesId = _series.SeriesId) .With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series) .With(e => e.Series = _series)
.With(e => e.EpisodeFile = _episodeFile) .With(e => e.EpisodeFile = _episodeFile)
.Build(); .Build();

View File

@ -3,6 +3,7 @@ using System.Linq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.History; using NzbDrone.Core.History;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;

View File

@ -76,7 +76,7 @@ namespace NzbDrone.Core.Test.Indexers
public class MockIndexer : IndexerBase public class MockIndexer : IndexerBase
{ {
public MockIndexer(HttpProvider httpProvider, ConfigService configService) public MockIndexer(HttpProvider httpProvider, IConfigService configService)
: base(httpProvider, configService) : base(httpProvider, configService)
{ {
} }
@ -134,7 +134,7 @@ namespace NzbDrone.Core.Test.Indexers
public class TestUrlIndexer : IndexerBase public class TestUrlIndexer : IndexerBase
{ {
public TestUrlIndexer(HttpProvider httpProvider, ConfigService configService) public TestUrlIndexer(HttpProvider httpProvider, IConfigService configService)
: base(httpProvider, configService) : base(httpProvider, configService)
{ {
} }
@ -187,7 +187,7 @@ namespace NzbDrone.Core.Test.Indexers
public class CustomParserIndexer : IndexerBase public class CustomParserIndexer : IndexerBase
{ {
public CustomParserIndexer(HttpProvider httpProvider, ConfigService configService) public CustomParserIndexer(HttpProvider httpProvider, IConfigService configService)
: base(httpProvider, configService) : base(httpProvider, configService)
{ {
} }
@ -247,7 +247,7 @@ namespace NzbDrone.Core.Test.Indexers
public class NotConfiguredIndexer : IndexerBase public class NotConfiguredIndexer : IndexerBase
{ {
public NotConfiguredIndexer(HttpProvider httpProvider, ConfigService configService) public NotConfiguredIndexer(HttpProvider httpProvider, IConfigService configService)
: base(httpProvider, configService) : base(httpProvider, configService)
{ {
} }
@ -300,7 +300,7 @@ namespace NzbDrone.Core.Test.Indexers
public class DefaultEnabledIndexer : IndexerBase public class DefaultEnabledIndexer : IndexerBase
{ {
public DefaultEnabledIndexer(HttpProvider httpProvider, ConfigService configService) public DefaultEnabledIndexer(HttpProvider httpProvider, IConfigService configService)
: base(httpProvider, configService) : base(httpProvider, configService)
{ {
} }

View File

@ -158,7 +158,7 @@ namespace NzbDrone.Core.Test.JobTests
var episodes = Builder<Episode>.CreateListOfSize(5) var episodes = Builder<Episode>.CreateListOfSize(5)
.All() .All()
.With(e => e.Series = series) .With(e => e.Series = series)
.With(e => e.SeriesId = series.SeriesId) .With(e => e.SeriesId = series.OID)
.With(e => e.SeasonNumber = 1) .With(e => e.SeasonNumber = 1)
.Build(); .Build();
@ -198,7 +198,7 @@ namespace NzbDrone.Core.Test.JobTests
var episodes = Builder<Episode>.CreateListOfSize(10) var episodes = Builder<Episode>.CreateListOfSize(10)
.TheFirst(5) .TheFirst(5)
.With(e => e.Series = series) .With(e => e.Series = series)
.With(e => e.SeriesId = series.SeriesId) .With(e => e.SeriesId = series.OID)
.With(e => e.SeasonNumber = 1) .With(e => e.SeasonNumber = 1)
.TheNext(5) .TheNext(5)
.With(e => e.Series = series2) .With(e => e.Series = series2)

View File

@ -82,10 +82,10 @@ namespace NzbDrone.Core.Test.JobTests
var series = Builder<Series>.CreateNew() var series = Builder<Series>.CreateNew()
.Build(); .Build();
Mocker.GetMock<ISeriesRepository>().Setup(s => s.Get(series.SeriesId)) Mocker.GetMock<ISeriesRepository>().Setup(s => s.Get(series.OID))
.Returns(series); .Returns(series);
Mocker.Resolve<BannerDownloadJob>().Start(_notification, new { SeriesId = series.SeriesId }); Mocker.Resolve<BannerDownloadJob>().Start(_notification, new { SeriesId = series.OID });
VerifyDownloadMock(1); VerifyDownloadMock(1);
} }
} }

View File

@ -26,12 +26,12 @@ namespace NzbDrone.Core.Test.JobTests
public void series_specific_scan_should_scan_series() public void series_specific_scan_should_scan_series()
{ {
var series = Builder<Series>.CreateNew() var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12) .With(s => s.OID = 12)
.Build(); .Build();
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
.Setup(p => p.Get(series.SeriesId)); .Setup(p => p.Get(series.OID));
Mocker.GetMock<DiskScanProvider>() Mocker.GetMock<DiskScanProvider>()
@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.JobTests
.Returns(new List<EpisodeFile>()); .Returns(new List<EpisodeFile>());
//Act //Act
Mocker.Resolve<DiskScanJob>().Start(new ProgressNotification("Test"), new { SeriesId = series.SeriesId }); Mocker.Resolve<DiskScanJob>().Start(new ProgressNotification("Test"), new { SeriesId = series.OID });
//Assert //Assert
Mocker.VerifyAllMocks(); Mocker.VerifyAllMocks();
@ -51,8 +51,8 @@ namespace NzbDrone.Core.Test.JobTests
public void job_with_no_target_should_scan_all_series() public void job_with_no_target_should_scan_all_series()
{ {
var series = Builder<Series>.CreateListOfSize(2) var series = Builder<Series>.CreateListOfSize(2)
.TheFirst(1).With(s => s.SeriesId = 12) .TheFirst(1).With(s => s.OID = 12)
.TheNext(1).With(s => s.SeriesId = 15) .TheNext(1).With(s => s.OID = 15)
.Build().ToList(); .Build().ToList();
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
@ -77,8 +77,8 @@ namespace NzbDrone.Core.Test.JobTests
public void failed_scan_should_not_terminated_job() public void failed_scan_should_not_terminated_job()
{ {
var series = Builder<Series>.CreateListOfSize(2) var series = Builder<Series>.CreateListOfSize(2)
.TheFirst(1).With(s => s.SeriesId = 12) .TheFirst(1).With(s => s.OID = 12)
.TheNext(1).With(s => s.SeriesId = 15) .TheNext(1).With(s => s.OID = 15)
.Build().ToList(); .Build().ToList();
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
@ -104,8 +104,8 @@ namespace NzbDrone.Core.Test.JobTests
public void job_with_no_target_should_scan_series_with_episodes() public void job_with_no_target_should_scan_series_with_episodes()
{ {
var series = Builder<Series>.CreateListOfSize(2) var series = Builder<Series>.CreateListOfSize(2)
.TheFirst(1).With(s => s.SeriesId = 12) .TheFirst(1).With(s => s.OID = 12)
.TheNext(1).With(s => s.SeriesId = 15) .TheNext(1).With(s => s.OID = 15)
.Build().ToList(); .Build().ToList();
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()

View File

@ -26,8 +26,8 @@ namespace NzbDrone.Core.Test.JobTests
{ {
var series = Builder<Series>.CreateListOfSize(2) var series = Builder<Series>.CreateListOfSize(2)
.All().With(s => s.LastInfoSync = null) .All().With(s => s.LastInfoSync = null)
.TheFirst(1).With(s => s.SeriesId = 12) .TheFirst(1).With(s => s.OID = 12)
.TheNext(1).With(s => s.SeriesId = 15) .TheNext(1).With(s => s.OID = 15)
.Build(); .Build();
var notification = new ProgressNotification("Test"); var notification = new ProgressNotification("Test");
@ -40,11 +40,11 @@ namespace NzbDrone.Core.Test.JobTests
Mocker.GetMock<DiskScanJob>() Mocker.GetMock<DiskScanJob>()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)))
.Callback(() => series[0].LastDiskSync = DateTime.Now); .Callback(() => series[0].LastDiskSync = DateTime.Now);
Mocker.GetMock<DiskScanJob>() Mocker.GetMock<DiskScanJob>()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].SeriesId))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)))
.Callback(() => series[1].LastDiskSync = DateTime.Now); .Callback(() => series[1].LastDiskSync = DateTime.Now);
Mocker.GetMock<BannerDownloadJob>() Mocker.GetMock<BannerDownloadJob>()
@ -54,18 +54,18 @@ namespace NzbDrone.Core.Test.JobTests
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") > 0))); .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") > 0)));
Mocker.GetMock<UpdateInfoJob>() Mocker.GetMock<UpdateInfoJob>()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)))
.Callback(() => series[0].LastInfoSync = DateTime.Now); .Callback(() => series[0].LastInfoSync = DateTime.Now);
Mocker.GetMock<UpdateInfoJob>() Mocker.GetMock<UpdateInfoJob>()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].SeriesId))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)))
.Callback(() => series[1].LastInfoSync = DateTime.Now); .Callback(() => series[1].LastInfoSync = DateTime.Now);
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
.Setup(s => s.Get(series[0].SeriesId)).Returns(series[0]); .Setup(s => s.Get(series[0].OID)).Returns(series[0]);
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
.Setup(s => s.Get(series[1].SeriesId)).Returns(series[1]); .Setup(s => s.Get(series[1].OID)).Returns(series[1]);
Mocker.GetMock<MediaFileProvider>() Mocker.GetMock<MediaFileProvider>()
.Setup(s => s.GetSeriesFiles(It.IsAny<int>())).Returns(new List<EpisodeFile>()); .Setup(s => s.GetSeriesFiles(It.IsAny<int>())).Returns(new List<EpisodeFile>());
@ -74,11 +74,11 @@ namespace NzbDrone.Core.Test.JobTests
Mocker.Resolve<ImportNewSeriesJob>().Start(notification, null); Mocker.Resolve<ImportNewSeriesJob>().Start(notification, null);
//Assert //Assert
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)), Times.Once()); Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)), Times.Once());
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].SeriesId)), Times.Once()); Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)), Times.Once());
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)), Times.Once()); Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)), Times.Once());
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].SeriesId)), Times.Once()); Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)), Times.Once());
} }
@ -91,8 +91,8 @@ namespace NzbDrone.Core.Test.JobTests
{ {
var series = Builder<Series>.CreateListOfSize(2) var series = Builder<Series>.CreateListOfSize(2)
.All().With(s => s.LastInfoSync = null) .All().With(s => s.LastInfoSync = null)
.TheFirst(1).With(s => s.SeriesId = 12) .TheFirst(1).With(s => s.OID = 12)
.TheNext(1).With(s => s.SeriesId = 15) .TheNext(1).With(s => s.OID = 15)
.Build(); .Build();
var notification = new ProgressNotification("Test"); var notification = new ProgressNotification("Test");
@ -104,37 +104,37 @@ namespace NzbDrone.Core.Test.JobTests
.Returns(series); .Returns(series);
Mocker.GetMock<UpdateInfoJob>() Mocker.GetMock<UpdateInfoJob>()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)))
.Callback(() => series[0].LastInfoSync = DateTime.Now); .Callback(() => series[0].LastInfoSync = DateTime.Now);
Mocker.GetMock<UpdateInfoJob>() Mocker.GetMock<UpdateInfoJob>()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].SeriesId))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)))
.Throws(new InvalidOperationException()); .Throws(new InvalidOperationException());
Mocker.GetMock<DiskScanJob>() Mocker.GetMock<DiskScanJob>()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)))
.Callback(() => series[0].LastDiskSync = DateTime.Now); .Callback(() => series[0].LastDiskSync = DateTime.Now);
Mocker.GetMock<BannerDownloadJob>() Mocker.GetMock<BannerDownloadJob>()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId))); .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)));
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
.Setup(s => s.Get(series[0].SeriesId)).Returns(series[0]); .Setup(s => s.Get(series[0].OID)).Returns(series[0]);
Mocker.GetMock<MediaFileProvider>() Mocker.GetMock<MediaFileProvider>()
.Setup(s => s.GetSeriesFiles(It.IsAny<int>())).Returns(new List<EpisodeFile>()); .Setup(s => s.GetSeriesFiles(It.IsAny<int>())).Returns(new List<EpisodeFile>());
Mocker.GetMock<XemUpdateJob>() Mocker.GetMock<XemUpdateJob>()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId))); .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)));
//Act //Act
Mocker.Resolve<ImportNewSeriesJob>().Start(notification, null); Mocker.Resolve<ImportNewSeriesJob>().Start(notification, null);
//Assert //Assert
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)), Times.Once()); Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)), Times.Once());
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].SeriesId)), Times.Once()); Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)), Times.Once());
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)), Times.Once()); Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)), Times.Once());
ExceptionVerification.ExpectedErrors(1); ExceptionVerification.ExpectedErrors(1);

View File

@ -37,11 +37,11 @@ namespace NzbDrone.Core.Test.JobTests
.Build(); .Build();
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
.Setup(s => s.Get(_series.SeriesId)) .Setup(s => s.Get(_series.OID))
.Returns(_series); .Returns(_series);
Mocker.GetMock<MediaFileProvider>() Mocker.GetMock<MediaFileProvider>()
.Setup(s => s.GetSeasonFiles(_series.SeriesId, 5)) .Setup(s => s.GetSeasonFiles(_series.OID, 5))
.Returns(_episodeFiles); .Returns(_episodeFiles);
} }
@ -63,13 +63,13 @@ namespace NzbDrone.Core.Test.JobTests
public void should_throw_if_seasonId_is_less_than_zero() public void should_throw_if_seasonId_is_less_than_zero()
{ {
Assert.Throws<ArgumentException>(() => Assert.Throws<ArgumentException>(() =>
Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.SeriesId, SeasonNumber = -10 })); Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.OID, SeasonNumber = -10 }));
} }
[Test] [Test]
public void should_log_warning_if_no_episode_files_are_found() public void should_log_warning_if_no_episode_files_are_found()
{ {
Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.SeriesId, SeasonNumber = 10 }); Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.OID, SeasonNumber = 10 });
ExceptionVerification.ExpectedWarns(1); ExceptionVerification.ExpectedWarns(1);
} }
@ -77,7 +77,7 @@ namespace NzbDrone.Core.Test.JobTests
[Test] [Test]
public void should_return_if_no_episodes_are_moved() public void should_return_if_no_episodes_are_moved()
{ {
Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.SeriesId, SeasonNumber = 5 }); Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.OID, SeasonNumber = 5 });
Mocker.GetMock<MetadataProvider>().Verify(v => v.RemoveForEpisodeFiles(It.IsAny<List<EpisodeFile>>()), Times.Never()); Mocker.GetMock<MetadataProvider>().Verify(v => v.RemoveForEpisodeFiles(It.IsAny<List<EpisodeFile>>()), Times.Never());
} }
@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.JobTests
public void should_return_process_metadata_if_files_are_moved() public void should_return_process_metadata_if_files_are_moved()
{ {
WithMovedFiles(); WithMovedFiles();
Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.SeriesId, SeasonNumber = 5 }); Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.OID, SeasonNumber = 5 });
Mocker.GetMock<MetadataProvider>().Verify(v => v.RemoveForEpisodeFiles(It.IsAny<List<EpisodeFile>>()), Times.Once()); Mocker.GetMock<MetadataProvider>().Verify(v => v.RemoveForEpisodeFiles(It.IsAny<List<EpisodeFile>>()), Times.Once());
} }

View File

@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.ProviderTests
WithTempAsAppPath(); WithTempAsAppPath();
_series = Builder<Series>.CreateNew() _series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12345) .With(s => s.OID = 12345)
.Build(); .Build();
var path = @"C:\Windows\Temp"; var path = @"C:\Windows\Temp";

View File

@ -81,7 +81,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Build(); .Build();
var series = Builder<Series>.CreateNew() var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = seriesId) .With(s => s.OID = seriesId)
.With(s => s.Title = "The Office") .With(s => s.Title = "The Office")
.Build(); .Build();

View File

@ -28,13 +28,13 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
public void should_not_move_file_if_source_and_destination_are_the_same_path() public void should_not_move_file_if_source_and_destination_are_the_same_path()
{ {
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 5) .With(s => s.OID = 5)
.With(s => s.Title = "30 Rock") .With(s => s.Title = "30 Rock")
.Build(); .Build();
var fakeEpisode = Builder<Episode>.CreateListOfSize(1) var fakeEpisode = Builder<Episode>.CreateListOfSize(1)
.All() .All()
.With(e => e.SeriesId = fakeSeries.SeriesId) .With(e => e.SeriesId = fakeSeries.OID)
.With(e => e.SeasonNumber = 1) .With(e => e.SeasonNumber = 1)
.With(e => e.EpisodeNumber = 1) .With(e => e.EpisodeNumber = 1)
.Build(); .Build();
@ -43,12 +43,12 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fi = new FileInfo(Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", filename + ".avi")); var fi = new FileInfo(Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", filename + ".avi"));
var file = Builder<EpisodeFile>.CreateNew() var file = Builder<EpisodeFile>.CreateNew()
.With(f => f.SeriesId = fakeSeries.SeriesId) .With(f => f.SeriesId = fakeSeries.OID)
.With(f => f.Path = fi.FullName) .With(f => f.Path = fi.FullName)
.Build(); .Build();
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
.Setup(e => e.Get(fakeSeries.SeriesId)) .Setup(e => e.Get(fakeSeries.OID))
.Returns(fakeSeries); .Returns(fakeSeries);
Mocker.GetMock<IEpisodeService>() Mocker.GetMock<IEpisodeService>()
@ -74,13 +74,13 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
public void should_use_EpisodeFiles_quality() public void should_use_EpisodeFiles_quality()
{ {
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 5) .With(s => s.OID = 5)
.With(s => s.Title = "30 Rock") .With(s => s.Title = "30 Rock")
.Build(); .Build();
var fakeEpisode = Builder<Episode>.CreateListOfSize(1) var fakeEpisode = Builder<Episode>.CreateListOfSize(1)
.All() .All()
.With(e => e.SeriesId = fakeSeries.SeriesId) .With(e => e.SeriesId = fakeSeries.OID)
.With(e => e.SeasonNumber = 1) .With(e => e.SeasonNumber = 1)
.With(e => e.EpisodeNumber = 1) .With(e => e.EpisodeNumber = 1)
.Build(); .Build();
@ -91,14 +91,14 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
const string message = "30 Rock - 1x01 - [WEBDL]"; const string message = "30 Rock - 1x01 - [WEBDL]";
var file = Builder<EpisodeFile>.CreateNew() var file = Builder<EpisodeFile>.CreateNew()
.With(f => f.SeriesId = fakeSeries.SeriesId) .With(f => f.SeriesId = fakeSeries.OID)
.With(f => f.Path = currentFilename) .With(f => f.Path = currentFilename)
.With(f => f.Quality = QualityTypes.WEBDL720p) .With(f => f.Quality = QualityTypes.WEBDL720p)
.With(f => f.Proper = false) .With(f => f.Proper = false)
.Build(); .Build();
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
.Setup(e => e.Get(fakeSeries.SeriesId)) .Setup(e => e.Get(fakeSeries.OID))
.Returns(fakeSeries); .Returns(fakeSeries);
Mocker.GetMock<IEpisodeService>() Mocker.GetMock<IEpisodeService>()
@ -133,13 +133,13 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
public void should_log_error_and_return_null_when_source_file_does_not_exists() public void should_log_error_and_return_null_when_source_file_does_not_exists()
{ {
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 5) .With(s => s.OID = 5)
.With(s => s.Title = "30 Rock") .With(s => s.Title = "30 Rock")
.Build(); .Build();
var fakeEpisode = Builder<Episode>.CreateListOfSize(1) var fakeEpisode = Builder<Episode>.CreateListOfSize(1)
.All() .All()
.With(e => e.SeriesId = fakeSeries.SeriesId) .With(e => e.SeriesId = fakeSeries.OID)
.With(e => e.SeasonNumber = 1) .With(e => e.SeasonNumber = 1)
.With(e => e.EpisodeNumber = 1) .With(e => e.EpisodeNumber = 1)
.Build(); .Build();
@ -150,14 +150,14 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
const string message = "30 Rock - 1x01 - [WEBDL]"; const string message = "30 Rock - 1x01 - [WEBDL]";
var file = Builder<EpisodeFile>.CreateNew() var file = Builder<EpisodeFile>.CreateNew()
.With(f => f.SeriesId = fakeSeries.SeriesId) .With(f => f.SeriesId = fakeSeries.OID)
.With(f => f.Path = currentFilename) .With(f => f.Path = currentFilename)
.With(f => f.Quality = QualityTypes.WEBDL720p) .With(f => f.Quality = QualityTypes.WEBDL720p)
.With(f => f.Proper = false) .With(f => f.Proper = false)
.Build(); .Build();
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
.Setup(e => e.Get(fakeSeries.SeriesId)) .Setup(e => e.Get(fakeSeries.OID))
.Returns(fakeSeries); .Returns(fakeSeries);
Mocker.GetMock<IEpisodeService>() Mocker.GetMock<IEpisodeService>()

View File

@ -97,7 +97,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.Returns(true); .Returns(true);
var series = Builder<Series>.CreateNew() var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12).Build(); .With(s => s.OID = 12).Build();
//Act //Act
Mocker.Resolve<DiskScanProvider>().Scan(series); Mocker.Resolve<DiskScanProvider>().Scan(series);

View File

@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
series = Builder<Series> series = Builder<Series>
.CreateNew() .CreateNew()
.With(s => s.SeriesId == 79488) .With(s => s.OID == 79488)
.With(s => s.Title == "30 Rock") .With(s => s.Title == "30 Rock")
.Build(); .Build();

View File

@ -37,7 +37,7 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
series = Builder<Series> series = Builder<Series>
.CreateNew() .CreateNew()
.With(s => s.SeriesId == 79488) .With(s => s.OID == 79488)
.With(s => s.Title == "30 Rock") .With(s => s.Title == "30 Rock")
.Build(); .Build();

View File

@ -72,7 +72,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
{ {
var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2) var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
.All() .All()
.With(f => f.SeriesId = fakeSeries.SeriesId) .With(f => f.SeriesId = fakeSeries.OID)
.Build().ToList(); .Build().ToList();
Mocker.GetMock<DiskScanProvider>().Setup(s => s.Scan(fakeSeries, droppedFolder)).Returns(fakeEpisodeFiles); Mocker.GetMock<DiskScanProvider>().Setup(s => s.Scan(fakeSeries, droppedFolder)).Returns(fakeEpisodeFiles);
@ -224,7 +224,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2) var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
.All() .All()
.With(f => f.SeriesId = fakeSeries.SeriesId) .With(f => f.SeriesId = fakeSeries.OID)
.Build().ToList(); .Build().ToList();
//Act //Act

View File

@ -71,7 +71,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
private void WithImportedFile(string file) private void WithImportedFile(string file)
{ {
var fakeEpisodeFile = Builder<EpisodeFile>.CreateNew() var fakeEpisodeFile = Builder<EpisodeFile>.CreateNew()
.With(f => f.SeriesId = fakeSeries.SeriesId) .With(f => f.SeriesId = fakeSeries.OID)
.Build(); .Build();
Mocker.GetMock<DiskScanProvider>().Setup(s => s.ImportFile(fakeSeries, file)).Returns(fakeEpisodeFile); Mocker.GetMock<DiskScanProvider>().Setup(s => s.ImportFile(fakeSeries, file)).Returns(fakeEpisodeFile);

View File

@ -138,11 +138,11 @@ namespace NzbDrone.Core.Test.ProviderTests
.All() .All()
.With(s => s.SeriesType = SeriesType.Standard) .With(s => s.SeriesType = SeriesType.Standard)
.TheFirst(1) .TheFirst(1)
.With(s => s.SeriesId = 10) .With(s => s.OID = 10)
.TheNext(1) .TheNext(1)
.With(s => s.SeriesId = 11) .With(s => s.OID = 11)
.TheNext(1) .TheNext(1)
.With(s => s.SeriesId = 12) .With(s => s.OID = 12)
.Build(); .Build();
Db.InsertMany(fakeSeries); Db.InsertMany(fakeSeries);
@ -170,12 +170,12 @@ namespace NzbDrone.Core.Test.ProviderTests
.All() .All()
.With(s => s.SeriesType = SeriesType.Standard) .With(s => s.SeriesType = SeriesType.Standard)
.TheFirst(1) .TheFirst(1)
.With(s => s.SeriesId = 10) .With(s => s.OID = 10)
.With(s => s.SeriesType = SeriesType.Daily) .With(s => s.SeriesType = SeriesType.Daily)
.TheNext(1) .TheNext(1)
.With(s => s.SeriesId = 11) .With(s => s.OID = 11)
.TheNext(1) .TheNext(1)
.With(s => s.SeriesId = 12) .With(s => s.OID = 12)
.Build(); .Build();
Db.InsertMany(fakeSeries); Db.InsertMany(fakeSeries);

View File

@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.ProviderTests
_searchHistory = Builder<SearchHistory>.CreateNew() _searchHistory = Builder<SearchHistory>.CreateNew()
.With(h => h.EpisodeId = _episode.OID) .With(h => h.EpisodeId = _episode.OID)
.With(h => h.SeriesId - _series.SeriesId) .With(h => h.SeriesId - _series.OID)
.With(h => h.SearchHistoryItems = items) .With(h => h.SearchHistoryItems = items)
.Build(); .Build();
} }

View File

@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.DailyEpisodeSearchTests
_episode = Builder<Episode> _episode = Builder<Episode>
.CreateNew() .CreateNew()
.With(e => e.SeriesId = _series.SeriesId) .With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series) .With(e => e.Series = _series)
.Build(); .Build();

View File

@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.EpisodeSearchTests
_episode = Builder<Episode> _episode = Builder<Episode>
.CreateNew() .CreateNew()
.With(e => e.SeriesId = _series.SeriesId) .With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series) .With(e => e.Series = _series)
.Build(); .Build();

View File

@ -29,7 +29,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
private void WithSceneMapping() private void WithSceneMapping()
{ {
Mocker.GetMock<SceneMappingProvider>() Mocker.GetMock<SceneMappingProvider>()
.Setup(s => s.GetSceneName(_series.SeriesId, -1)) .Setup(s => s.GetSceneName(_series.OID, -1))
.Returns("Hawaii Five 0 2010"); .Returns("Hawaii Five 0 2010");
} }
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
public void should_return_season_scene_name_when_one_exists() public void should_return_season_scene_name_when_one_exists()
{ {
Mocker.GetMock<SceneMappingProvider>() Mocker.GetMock<SceneMappingProvider>()
.Setup(s => s.GetSceneName(_series.SeriesId, 5)) .Setup(s => s.GetSceneName(_series.OID, 5))
.Returns("Hawaii Five 0 2010 - Season 5"); .Returns("Hawaii Five 0 2010 - Season 5");
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5) Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)
@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
_series.Title = input; _series.Title = input;
Mocker.GetMock<SceneMappingProvider>() Mocker.GetMock<SceneMappingProvider>()
.Setup(s => s.GetSceneName(_series.SeriesId, -1)) .Setup(s => s.GetSceneName(_series.OID, -1))
.Returns(""); .Returns("");
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5) Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)

View File

@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.PartialSeasonSearchTests
_episodes = Builder<Episode> _episodes = Builder<Episode>
.CreateListOfSize(10) .CreateListOfSize(10)
.All() .All()
.With(e => e.SeriesId = _series.SeriesId) .With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series) .With(e => e.Series = _series)
.Build() .Build()
.ToList(); .ToList();

View File

@ -36,14 +36,14 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
_episode = Builder<Episode> _episode = Builder<Episode>
.CreateNew() .CreateNew()
.With(e => e.SeriesId = _series.SeriesId) .With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series) .With(e => e.Series = _series)
.Build(); .Build();
_episodes = Builder<Episode> _episodes = Builder<Episode>
.CreateListOfSize(10) .CreateListOfSize(10)
.All() .All()
.With(e => e.SeriesId = _series.SeriesId) .With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series) .With(e => e.Series = _series)
.Build() .Build()
.ToList(); .ToList();

View File

@ -36,12 +36,12 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
public void Setup() public void Setup()
{ {
_matchingSeries = Builder<Series>.CreateNew() _matchingSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488) .With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock") .With(s => s.Title = "30 Rock")
.Build(); .Build();
_mismatchedSeries = Builder<Series>.CreateNew() _mismatchedSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12345) .With(s => s.OID = 12345)
.With(s => s.Title = "Not 30 Rock") .With(s => s.Title = "Not 30 Rock")
.Build(); .Build();

View File

@ -46,11 +46,11 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageMappingProviderTests
.Build(); .Build();
Mocker.GetMock<IEpisodeService>() Mocker.GetMock<IEpisodeService>()
.Setup(s => s.GetEpisode(_series.SeriesId, 1, 1)) .Setup(s => s.GetEpisode(_series.OID, 1, 1))
.Returns(_episode); .Returns(_episode);
Mocker.GetMock<SceneMappingProvider>() Mocker.GetMock<SceneMappingProvider>()
.Setup(s => s.GetCleanName(_series.SeriesId)) .Setup(s => s.GetCleanName(_series.OID))
.Returns(""); .Returns("");
Mocker.GetMock<TvRageProvider>() Mocker.GetMock<TvRageProvider>()

View File

@ -43,7 +43,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.Build(); .Build();
series = Builder<Series>.CreateNew() series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 1) .With(s => s.OID = 1)
.And(c => c.Monitored = true) .And(c => c.Monitored = true)
.Build(); .Build();
@ -71,7 +71,7 @@ namespace NzbDrone.Core.Test.ProviderTests
//Assert //Assert
result.Should().HaveCount(5); result.Should().HaveCount(5);
result.Should().OnlyContain(c => c.Series != null && c.SeriesId == series.SeriesId); result.Should().OnlyContain(c => c.Series != null && c.SeriesId == series.OID);
} }
[Test] [Test]

View File

@ -465,7 +465,7 @@ namespace NzbDrone.Core.Test.ProviderTests
var url = "http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video,smb://xbmc:xbmc@HOMESERVER/TV/30 Rock/))"; var url = "http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video,smb://xbmc:xbmc@HOMESERVER/TV/30 Rock/))";
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488) .With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock") .With(s => s.Title = "30 Rock")
.Build(); .Build();
@ -491,7 +491,7 @@ namespace NzbDrone.Core.Test.ProviderTests
var url = "http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video))"; var url = "http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video))";
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488) .With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock") .With(s => s.Title = "30 Rock")
.Build(); .Build();
@ -519,7 +519,7 @@ namespace NzbDrone.Core.Test.ProviderTests
var tvshows = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/30 Rock/\",\"imdbnumber\":\"79488\",\"label\":\"30 Rock\",\"tvshowid\":2},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}"; var tvshows = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/30 Rock/\",\"imdbnumber\":\"79488\",\"label\":\"30 Rock\",\"tvshowid\":2},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}";
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488) .With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock") .With(s => s.Title = "30 Rock")
.Build(); .Build();
@ -552,7 +552,7 @@ namespace NzbDrone.Core.Test.ProviderTests
var tvshows = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}"; var tvshows = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}";
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488) .With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock") .With(s => s.Title = "30 Rock")
.Build(); .Build();
@ -585,7 +585,7 @@ namespace NzbDrone.Core.Test.ProviderTests
var tvshows = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/30 Rock/\",\"imdbnumber\":\"79488\",\"label\":\"30 Rock\",\"tvshowid\":2},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}"; var tvshows = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/30 Rock/\",\"imdbnumber\":\"79488\",\"label\":\"30 Rock\",\"tvshowid\":2},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}";
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488) .With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock") .With(s => s.Title = "30 Rock")
.Build(); .Build();
@ -617,7 +617,7 @@ namespace NzbDrone.Core.Test.ProviderTests
var tvshows = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}"; var tvshows = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}";
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488) .With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock") .With(s => s.Title = "30 Rock")
.Build(); .Build();

View File

@ -50,7 +50,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
WithRealDb(); WithRealDb();
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 1) .With(s => s.OID = 1)
.Build(); .Build();
var fakeEpisodes = Builder<Episode>.CreateNew() var fakeEpisodes = Builder<Episode>.CreateNew()
.With(e => e.SeriesId = 1) .With(e => e.SeriesId = 1)
@ -61,7 +61,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
Db.Insert(fakeEpisodes); Db.Insert(fakeEpisodes);
//Act //Act
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(fakeSeries.SeriesId, 2, 1); var episode = Mocker.Resolve<EpisodeService>().GetEpisode(fakeSeries.OID, 2, 1);
//Assert //Assert
episode.ShouldHave().AllPropertiesBut(e => e.Series).EqualTo(fakeEpisodes); episode.ShouldHave().AllPropertiesBut(e => e.Series).EqualTo(fakeEpisodes);
@ -128,7 +128,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
WithRealDb(); WithRealDb();
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12) .With(s => s.OID = 12)
.Build(); .Build();
var episodes = Builder<Episode>.CreateListOfSize(10) var episodes = Builder<Episode>.CreateListOfSize(10)
@ -162,7 +162,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build()) .Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
WithRealDb(); WithRealDb();
@ -196,7 +196,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build()) .Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
WithRealDb(); WithRealDb();
@ -237,7 +237,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build()) .Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
WithRealDb(); WithRealDb();
Db.Insert(fakeSeries); Db.Insert(fakeSeries);
@ -274,7 +274,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build()) .Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
WithRealDb(); WithRealDb();
@ -313,7 +313,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build()) .Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
WithRealDb(); WithRealDb();
@ -351,7 +351,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build()) .Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
WithRealDb(); WithRealDb();
@ -384,7 +384,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build()) .Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
WithRealDb(); WithRealDb();
@ -417,7 +417,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build()) .Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
WithRealDb(); WithRealDb();
@ -452,7 +452,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build()) .Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
WithRealDb(); WithRealDb();
@ -484,7 +484,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build()) .With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
var currentEpisodes = new List<Episode>(); var currentEpisodes = new List<Episode>();
@ -515,7 +515,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build()) .With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
var currentEpisodes = new List<Episode>(); var currentEpisodes = new List<Episode>();
foreach (var tvDbEpisode in tvdbSeries.Episodes) foreach (var tvDbEpisode in tvdbSeries.Episodes)
@ -553,7 +553,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
) )
.Build(); .Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
var fakeEpisodeList = new List<Episode> { new Episode { TvDbEpisodeId = 99, SeasonNumber = 10, EpisodeNumber = 10, Series = fakeSeries } }; var fakeEpisodeList = new List<Episode> { new Episode { TvDbEpisodeId = 99, SeasonNumber = 10, EpisodeNumber = 10, Series = fakeSeries } };
Mocker.GetMock<IDatabase>() Mocker.GetMock<IDatabase>()
@ -595,7 +595,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build(); .Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict) Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
.Setup(c => c.GetSeries(seriesId, true, false)) .Setup(c => c.GetSeries(seriesId, true, false))
@ -621,7 +621,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build()) .With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
var currentEpisodes = new List<Episode>(); var currentEpisodes = new List<Episode>();
foreach (var tvDbEpisode in tvdbSeries.Episodes) foreach (var tvDbEpisode in tvdbSeries.Episodes)
@ -670,7 +670,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build()) .With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
var currentEpisodes = new List<Episode>(); var currentEpisodes = new List<Episode>();
foreach (var tvDbEpisode in tvdbSeries.Episodes) foreach (var tvDbEpisode in tvdbSeries.Episodes)
@ -716,7 +716,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build()) .With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
var currentEpisodes = new List<Episode>(); var currentEpisodes = new List<Episode>();
foreach (var tvDbEpisode in tvdbSeries.Episodes) foreach (var tvDbEpisode in tvdbSeries.Episodes)
@ -784,7 +784,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build()) .Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
WithRealDb(); WithRealDb();
@ -1121,7 +1121,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
WithRealDb(); WithRealDb();
var series = Builder<Series>.CreateNew() var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 10) .With(s => s.OID = 10)
.Build(); .Build();
var episodes = Builder<Episode>.CreateListOfSize(4) var episodes = Builder<Episode>.CreateListOfSize(4)
@ -1164,7 +1164,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
WithRealDb(); WithRealDb();
var series = Builder<Series>.CreateNew() var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 10) .With(s => s.OID = 10)
.Build(); .Build();
var episodes = Builder<Episode>.CreateListOfSize(4) var episodes = Builder<Episode>.CreateListOfSize(4)
@ -1208,7 +1208,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
WithRealDb(); WithRealDb();
var series = Builder<Series>.CreateNew() var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 10) .With(s => s.OID = 10)
.Build(); .Build();
var episodeFile = Builder<EpisodeFile>.CreateNew() var episodeFile = Builder<EpisodeFile>.CreateNew()
@ -1252,7 +1252,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
WithRealDb(); WithRealDb();
var series = Builder<Series>.CreateNew() var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 10) .With(s => s.OID = 10)
.Build(); .Build();
var episodes = Builder<Episode>.CreateListOfSize(2) var episodes = Builder<Episode>.CreateListOfSize(2)
@ -1281,7 +1281,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
WithRealDb(); WithRealDb();
var series = Builder<Series>.CreateNew() var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 10) .With(s => s.OID = 10)
.Build(); .Build();
var fakeEpisodes = Builder<Episode>.CreateListOfSize(2) var fakeEpisodes = Builder<Episode>.CreateListOfSize(2)
@ -1308,7 +1308,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
WithRealDb(); WithRealDb();
var series = Builder<Series>.CreateNew() var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 10) .With(s => s.OID = 10)
.Build(); .Build();
var fakeEpisode = Builder<Episode>.CreateNew() var fakeEpisode = Builder<Episode>.CreateNew()
@ -1400,7 +1400,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
WithRealDb(); WithRealDb();
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12345) .With(s => s.OID = 12345)
.With(s => s.CleanTitle = "officeus") .With(s => s.CleanTitle = "officeus")
.Build(); .Build();
@ -1432,7 +1432,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
var postDownloadStatus = PostDownloadStatusType.Failed; var postDownloadStatus = PostDownloadStatusType.Failed;
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12345) .With(s => s.OID = 12345)
.With(s => s.CleanTitle = "officeus") .With(s => s.CleanTitle = "officeus")
.Build(); .Build();
@ -1489,7 +1489,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build()) .Build())
).With(c => c.Id = seriesId).Build(); ).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
WithRealDb(); WithRealDb();

View File

@ -29,7 +29,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(c => c.SeriesId = seriesId) .With(c => c.OID = seriesId)
.Build(); .Build();
var fakeEpisode = Builder<Episode>.CreateNew() var fakeEpisode = Builder<Episode>.CreateNew()
@ -65,7 +65,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build(); .Build();
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(c => c.SeriesId = seriesId) .With(c => c.OID = seriesId)
.Build(); .Build();
var fakeEpisode = Builder<Episode>.CreateNew() var fakeEpisode = Builder<Episode>.CreateNew()
@ -101,7 +101,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build(); .Build();
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(c => c.SeriesId = seriesId) .With(c => c.OID = seriesId)
.Build(); .Build();
var fakeEpisode = Builder<Episode>.CreateNew() var fakeEpisode = Builder<Episode>.CreateNew()
@ -135,7 +135,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build(); .Build();
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(c => c.SeriesId = seriesId) .With(c => c.OID = seriesId)
.Build(); .Build();
var fakeEpisode = Builder<Episode>.CreateNew() var fakeEpisode = Builder<Episode>.CreateNew()
@ -174,7 +174,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build(); .Build();
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(c => c.SeriesId = seriesId) .With(c => c.OID = seriesId)
.Build(); .Build();
var fakeEpisode = Builder<Episode>.CreateNew() var fakeEpisode = Builder<Episode>.CreateNew()
@ -186,7 +186,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
//Other Series //Other Series
var otherFakeSeries = Builder<Series>.CreateNew() var otherFakeSeries = Builder<Series>.CreateNew()
.With(c => c.SeriesId = 12345) .With(c => c.OID = 12345)
.Build(); .Build();
var otherFakeEpisode = Builder<Episode>.CreateNew() var otherFakeEpisode = Builder<Episode>.CreateNew()

View File

@ -36,19 +36,19 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Build(); .Build();
fakeEpisode = Builder<Episode>.CreateNew() fakeEpisode = Builder<Episode>.CreateNew()
.With(e => e.SeriesId = fakeSeries.SeriesId) .With(e => e.SeriesId = fakeSeries.OID)
.With(e => e.Title = "Episode (1)") .With(e => e.Title = "Episode (1)")
.Build(); .Build();
fakeEpisode2 = Builder<Episode>.CreateNew() fakeEpisode2 = Builder<Episode>.CreateNew()
.With(e => e.SeriesId = fakeSeries.SeriesId) .With(e => e.SeriesId = fakeSeries.OID)
.With(e => e.SeasonNumber = fakeEpisode.SeasonNumber) .With(e => e.SeasonNumber = fakeEpisode.SeasonNumber)
.With(e => e.EpisodeNumber = fakeEpisode.EpisodeNumber + 1) .With(e => e.EpisodeNumber = fakeEpisode.EpisodeNumber + 1)
.With(e => e.Title = "Episode (2)") .With(e => e.Title = "Episode (2)")
.Build(); .Build();
fakeDailyEpisode = Builder<Episode>.CreateNew() fakeDailyEpisode = Builder<Episode>.CreateNew()
.With(e => e.SeriesId = fakeSeries.SeriesId) .With(e => e.SeriesId = fakeSeries.OID)
.With(e => e.AirDate = DateTime.Now.Date) .With(e => e.AirDate = DateTime.Now.Date)
.With(e => e.Title = "Daily Episode 1") .With(e => e.Title = "Daily Episode 1")
.Build(); .Build();

View File

@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
{ {
_episode = Builder<Episode> _episode = Builder<Episode>
.CreateNew() .CreateNew()
.With(e => e.SeriesId = _series.SeriesId) .With(e => e.SeriesId = _series.OID)
.Build(); .Build();
Db.Insert(_episode); Db.Insert(_episode);
@ -43,7 +43,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
{ {
_episode = Builder<Episode> _episode = Builder<Episode>
.CreateNew() .CreateNew()
.With(e => e.SeriesId = _series.SeriesId) .With(e => e.SeriesId = _series.OID)
.Build(); .Build();
Db.Insert(_episode); Db.Insert(_episode);
@ -52,14 +52,14 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
[Test] [Test]
public void should_return_null_if_no_episodes_in_db() public void should_return_null_if_no_episodes_in_db()
{ {
Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.SeriesId, 1, 1).Should().BeNull(); Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.OID, 1, 1).Should().BeNull();
} }
[Test] [Test]
public void should_return_null_if_no_matching_episode_is_found() public void should_return_null_if_no_matching_episode_is_found()
{ {
WithNullSceneNumbering(); WithNullSceneNumbering();
Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.SeriesId, 1, 1).Should().BeNull(); Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.OID, 1, 1).Should().BeNull();
} }
[Test] [Test]
@ -68,7 +68,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
WithSceneNumbering(); WithSceneNumbering();
var result = Mocker.Resolve<EpisodeService>() var result = Mocker.Resolve<EpisodeService>()
.GetEpisodeBySceneNumbering(_series.SeriesId, _episode.SceneSeasonNumber, _episode.SceneEpisodeNumber); .GetEpisodeBySceneNumbering(_series.OID, _episode.SceneSeasonNumber, _episode.SceneEpisodeNumber);
result.OID.Should().Be(_episode.OID); result.OID.Should().Be(_episode.OID);
} }

View File

@ -1,5 +1,6 @@
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;

View File

@ -30,7 +30,7 @@ namespace NzbDrone.Core.DecisionEngine
{ {
foreach (var episode in subject.Episodes) foreach (var episode in subject.Episodes)
{ {
var bestQualityInHistory = _historyService.GetBestQualityInHistory(subject.Series.SeriesId, episode.SeasonNumber, episode.EpisodeNumber); var bestQualityInHistory = _historyService.GetBestQualityInHistory(subject.Series.OID, episode.SeasonNumber, episode.EpisodeNumber);
if (bestQualityInHistory != null) if (bestQualityInHistory != null)
{ {
logger.Trace("Comparing history quality with report. History is {0}", bestQualityInHistory); logger.Trace("Comparing history quality with report. History is {0}", bestQualityInHistory);

View File

@ -27,7 +27,7 @@ namespace NzbDrone.Core.History
public QualityModel GetBestQualityInHistory(int seriesId, int seasonNumber, int episodeNumber) public QualityModel GetBestQualityInHistory(int seriesId, int seasonNumber, int episodeNumber)
{ {
var history = Queryable.OrderByDescending(c => c.Quality).FirstOrDefault(c => c.Episode.Series.SeriesId == seriesId && c.Episode.SeasonNumber == seasonNumber && var history = Queryable.OrderByDescending(c => c.Quality).FirstOrDefault(c => c.Episode.Series.OID == seriesId && c.Episode.SeasonNumber == seasonNumber &&
c.Episode.EpisodeNumber == episodeNumber); c.Episode.EpisodeNumber == episodeNumber);
if (history != null) if (history != null)

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
@ -65,7 +66,7 @@ namespace NzbDrone.Core.Jobs
private void ScanSeries(ProgressNotification notification) private void ScanSeries(ProgressNotification notification)
{ {
var syncList = _seriesRepository.All().Where(s => s.LastInfoSync == null && !_attemptedSeries.Contains(s.SeriesId)).ToList(); var syncList = _seriesRepository.All().Where(s => s.LastInfoSync == null && !_attemptedSeries.Contains(s.OID)).ToList();
if (syncList.Count == 0) if (syncList.Count == 0)
{ {
return; return;
@ -75,20 +76,20 @@ namespace NzbDrone.Core.Jobs
{ {
try try
{ {
_attemptedSeries.Add(currentSeries.OID); _attemptedSeries.Add(((ModelBase)currentSeries).OID);
notification.CurrentMessage = String.Format("Searching for '{0}'", new DirectoryInfo(currentSeries.Path).Name); notification.CurrentMessage = String.Format("Searching for '{0}'", new DirectoryInfo(currentSeries.Path).Name);
_updateInfoJob.Start(notification, new { SeriesId = currentSeries.OID }); _updateInfoJob.Start(notification, new { SeriesId = ((ModelBase)currentSeries).OID });
_diskScanJob.Start(notification, new { SeriesId = currentSeries.OID }); _diskScanJob.Start(notification, new { SeriesId = ((ModelBase)currentSeries).OID });
var updatedSeries = _seriesRepository.Get(currentSeries.OID); var updatedSeries = _seriesRepository.Get(((ModelBase)currentSeries).OID);
AutoIgnoreSeasons(updatedSeries.OID); AutoIgnoreSeasons(((ModelBase)updatedSeries).OID);
//Download the banner for the new series //Download the banner for the new series
_bannerDownloadJob.Start(notification, new { SeriesId = updatedSeries.OID }); _bannerDownloadJob.Start(notification, new { SeriesId = ((ModelBase)updatedSeries).OID });
//Get Scene Numbering if applicable //Get Scene Numbering if applicable
_xemUpdateJob.Start(notification, new { SeriesId = updatedSeries.OID }); _xemUpdateJob.Start(notification, new { SeriesId = ((ModelBase)updatedSeries).OID });
notification.CurrentMessage = String.Format("{0} was successfully imported", updatedSeries.Title); notification.CurrentMessage = String.Format("{0} was successfully imported", updatedSeries.Title);
} }

View File

@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System; using System;
using NLog; using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;

View File

@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System; using System;
using NLog; using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Helpers; using NzbDrone.Core.Helpers;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Text; using System.Text;
using NLog; using NLog;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;

View File

@ -5,6 +5,7 @@ using System.Linq;
using NLog; using NLog;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;

View File

@ -6,6 +6,7 @@ using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.ExternalNotification; using NzbDrone.Core.Providers.ExternalNotification;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using NLog; using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
@ -109,7 +110,7 @@ namespace NzbDrone.Core.Providers.Search
logger.Trace("Analysing report " + episodeParseResult); logger.Trace("Analysing report " + episodeParseResult);
episodeParseResult.Series = _seriesRepository.GetByTitle(episodeParseResult.CleanTitle); episodeParseResult.Series = _seriesRepository.GetByTitle(episodeParseResult.CleanTitle);
if(episodeParseResult.Series == null || episodeParseResult.Series.OID != series.OID) if(episodeParseResult.Series == null || ((ModelBase)episodeParseResult.Series).OID != series.OID)
{ {
item.SearchError = ReportRejectionType.WrongSeries; item.SearchError = ReportRejectionType.WrongSeries;
continue; continue;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using NLog; using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.TvRage; using NzbDrone.Core.Model.TvRage;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
@ -33,7 +34,7 @@ namespace NzbDrone.Core.Providers
{ {
var firstEpisode = _episodeService.GetEpisode(series.OID, 1, 1); var firstEpisode = _episodeService.GetEpisode(series.OID, 1, 1);
var cleanName = _sceneMappingProvider.GetCleanName(series.SeriesId); var cleanName = _sceneMappingProvider.GetCleanName(series.OID);
var results = _tvRageProvider.SearchSeries(series.Title); var results = _tvRageProvider.SearchSeries(series.Title);
var result = ProcessResults(results, series, cleanName, firstEpisode); var result = ProcessResults(results, series, cleanName, firstEpisode);

View File

@ -138,7 +138,7 @@ namespace NzbDrone.Core.Providers
Logger.Trace("Failed to get TV Shows from XBMC"); Logger.Trace("Failed to get TV Shows from XBMC");
else else
path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.SeriesId || s.Label == series.Title); path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.OID || s.Label == series.Title);
//var hostOnly = GetHostWithoutPort(host); //var hostOnly = GetHostWithoutPort(host);
@ -179,7 +179,7 @@ namespace NzbDrone.Core.Providers
Logger.Trace("Failed to get TV Shows from XBMC"); Logger.Trace("Failed to get TV Shows from XBMC");
else else
path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.SeriesId || s.Label == series.Title); path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.OID || s.Label == series.Title);
var postJson = new JObject(); var postJson = new JObject();
postJson.Add(new JProperty("jsonrpc", "2.0")); postJson.Add(new JProperty("jsonrpc", "2.0"));
@ -221,7 +221,7 @@ namespace NzbDrone.Core.Providers
try try
{ {
Logger.Trace("Sending Update DB Request to XBMC Host: {0}", host); Logger.Trace("Sending Update DB Request to XBMC Host: {0}", host);
var xbmcSeriesPath = GetXbmcSeriesPath(host, series.SeriesId, username, password); var xbmcSeriesPath = GetXbmcSeriesPath(host, series.OID, username, password);
//If the path is found update it, else update the whole library //If the path is found update it, else update the whole library
if (!String.IsNullOrEmpty(xbmcSeriesPath)) if (!String.IsNullOrEmpty(xbmcSeriesPath))

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using NLog; using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
@ -37,7 +38,7 @@ namespace NzbDrone.Core.Providers
{ {
var ids = _xemCommunicationProvider.GetXemSeriesIds(); var ids = _xemCommunicationProvider.GetXemSeriesIds();
var series = _seriesRepository.All(); var series = _seriesRepository.All();
var wantedSeries = series.Where(s => ids.Contains(s.SeriesId)).ToList(); var wantedSeries = series.Where(s => ids.Contains(s.OID)).ToList();
foreach(var ser in wantedSeries) foreach(var ser in wantedSeries)
{ {
@ -81,7 +82,7 @@ namespace NzbDrone.Core.Providers
try try
{ {
var episodesToUpdate = new List<Episode>(); var episodesToUpdate = new List<Episode>();
var mappings = _xemCommunicationProvider.GetSceneTvdbMappings(series.SeriesId); var mappings = _xemCommunicationProvider.GetSceneTvdbMappings(series.OID);
if (mappings == null) if (mappings == null)
{ {

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Common.Eventing; using NzbDrone.Common.Eventing;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
@ -94,7 +95,7 @@ namespace NzbDrone.Core.Tv
return new List<Episode>(); return new List<Episode>();
} }
var episodeInfo = GetEpisode(parseResult.Series.OID, parseResult.AirDate.Value); var episodeInfo = GetEpisode(((ModelBase)parseResult.Series).OID, parseResult.AirDate.Value);
if (episodeInfo != null) if (episodeInfo != null)
{ {
@ -116,14 +117,14 @@ namespace NzbDrone.Core.Tv
Episode episodeInfo = null; Episode episodeInfo = null;
if (parseResult.SceneSource && parseResult.Series.UseSceneNumbering) if (parseResult.SceneSource && parseResult.Series.UseSceneNumbering)
episodeInfo = GetEpisodeBySceneNumbering(parseResult.Series.OID, parseResult.SeasonNumber, episodeNumber); episodeInfo = GetEpisodeBySceneNumbering(((ModelBase)parseResult.Series).OID, parseResult.SeasonNumber, episodeNumber);
if (episodeInfo == null) if (episodeInfo == null)
{ {
episodeInfo = GetEpisode(parseResult.Series.OID, parseResult.SeasonNumber, episodeNumber); episodeInfo = GetEpisode(((ModelBase)parseResult.Series).OID, parseResult.SeasonNumber, episodeNumber);
if (episodeInfo == null && parseResult.AirDate != null) if (episodeInfo == null && parseResult.AirDate != null)
{ {
episodeInfo = GetEpisode(parseResult.Series.OID, parseResult.AirDate.Value); episodeInfo = GetEpisode(((ModelBase)parseResult.Series).OID, parseResult.AirDate.Value);
} }
} }
@ -180,7 +181,7 @@ namespace NzbDrone.Core.Tv
var successCount = 0; var successCount = 0;
var failCount = 0; var failCount = 0;
var tvdbEpisodes = _tvDbProvider.GetSeries(series.SeriesId, true) var tvdbEpisodes = _tvDbProvider.GetSeries(series.OID, true)
.Episodes .Episodes
.Where(episode => !string.IsNullOrWhiteSpace(episode.EpisodeName) || .Where(episode => !string.IsNullOrWhiteSpace(episode.EpisodeName) ||
(episode.FirstAired < DateTime.Now.AddDays(2) && episode.FirstAired.Year > 1900)) (episode.FirstAired < DateTime.Now.AddDays(2) && episode.FirstAired.Year > 1900))

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Core.Tv
public class Series : ModelBase public class Series : ModelBase
{ {
public virtual int SeriesId { get; set; } public int TvDbId { get; set; }
public string Title { get; set; } public string Title { get; set; }

View File

@ -6,6 +6,7 @@ using NLog;
using NzbDrone.Common.EnsureThat; using NzbDrone.Common.EnsureThat;
using NzbDrone.Common.Eventing; using NzbDrone.Common.Eventing;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
@ -58,7 +59,7 @@ namespace NzbDrone.Core.Tv
public Series UpdateSeriesInfo(int seriesId) public Series UpdateSeriesInfo(int seriesId)
{ {
var series = _seriesRepository.Get(seriesId); var series = _seriesRepository.Get(seriesId);
var tvDbSeries = _tvDbProvider.GetSeries(series.SeriesId, false, true); var tvDbSeries = _tvDbProvider.GetSeries(series.OID, false, true);
series.Title = tvDbSeries.SeriesName; series.Title = tvDbSeries.SeriesName;
series.AirTime = CleanAirsTime(tvDbSeries.AirsTime); series.AirTime = CleanAirsTime(tvDbSeries.AirsTime);
@ -118,7 +119,7 @@ namespace NzbDrone.Core.Tv
Ensure.That(() => path).IsNotNullOrWhiteSpace(); Ensure.That(() => path).IsNotNullOrWhiteSpace();
var repoSeries = new Series(); var repoSeries = new Series();
repoSeries.SeriesId = tvDbSeriesId; repoSeries.TvDbId = tvDbSeriesId;
repoSeries.Path = path; repoSeries.Path = path;
repoSeries.Monitored = true; repoSeries.Monitored = true;
repoSeries.QualityProfileId = qualityProfileId; repoSeries.QualityProfileId = qualityProfileId;
@ -145,7 +146,7 @@ namespace NzbDrone.Core.Tv
foreach (var series in allSeries) foreach (var series in allSeries)
{ {
//Only update parameters that can be changed in MassEdit //Only update parameters that can be changed in MassEdit
var edited = editedSeries.Single(s => s.OID == series.OID); var edited = editedSeries.Single(s => ((ModelBase)s).OID == series.OID);
series.QualityProfileId = edited.QualityProfileId; series.QualityProfileId = edited.QualityProfileId;
series.Monitored = edited.Monitored; series.Monitored = edited.Monitored;
series.SeasonFolder = edited.SeasonFolder; series.SeasonFolder = edited.SeasonFolder;