1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +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 @@ public void Setup()
firstQuality = 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.SeriesId, 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, 3)).Returns(firstQuality);
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 4)).Returns(secondQuality);
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 5)).Returns<QualityModel>(null);
}
private void WithFirstReportUpgradable()
@ -124,7 +124,7 @@ public void should_not_be_upgradable_if_episode_is_of_same_quality_as_existing()
parseResultSingle.Quality = 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();
}

View File

@ -39,7 +39,7 @@ public void SetUp()
.Build();
_episode = Builder<Episode>.CreateNew()
.With(e => e.SeriesId = _series.SeriesId)
.With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series)
.With(e => e.EpisodeFile = _episodeFile)
.Build();

View File

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

View File

@ -76,7 +76,7 @@ public void Init_indexer_should_not_enable_indexer_that_is_not_enabled_by_defaul
public class MockIndexer : IndexerBase
{
public MockIndexer(HttpProvider httpProvider, ConfigService configService)
public MockIndexer(HttpProvider httpProvider, IConfigService configService)
: base(httpProvider, configService)
{
}
@ -134,7 +134,7 @@ protected override string NzbInfoUrl(SyndicationItem item)
public class TestUrlIndexer : IndexerBase
{
public TestUrlIndexer(HttpProvider httpProvider, ConfigService configService)
public TestUrlIndexer(HttpProvider httpProvider, IConfigService configService)
: base(httpProvider, configService)
{
}
@ -187,7 +187,7 @@ protected override string NzbInfoUrl(SyndicationItem item)
public class CustomParserIndexer : IndexerBase
{
public CustomParserIndexer(HttpProvider httpProvider, ConfigService configService)
public CustomParserIndexer(HttpProvider httpProvider, IConfigService configService)
: base(httpProvider, configService)
{
}
@ -247,7 +247,7 @@ protected override EpisodeParseResult CustomParser(SyndicationItem item, Episode
public class NotConfiguredIndexer : IndexerBase
{
public NotConfiguredIndexer(HttpProvider httpProvider, ConfigService configService)
public NotConfiguredIndexer(HttpProvider httpProvider, IConfigService configService)
: base(httpProvider, configService)
{
}
@ -300,7 +300,7 @@ protected override string NzbInfoUrl(SyndicationItem item)
public class DefaultEnabledIndexer : IndexerBase
{
public DefaultEnabledIndexer(HttpProvider httpProvider, ConfigService configService)
public DefaultEnabledIndexer(HttpProvider httpProvider, IConfigService configService)
: base(httpProvider, configService)
{
}

View File

@ -158,7 +158,7 @@ public void series_season_missing_episodes_only()
var episodes = Builder<Episode>.CreateListOfSize(5)
.All()
.With(e => e.Series = series)
.With(e => e.SeriesId = series.SeriesId)
.With(e => e.SeriesId = series.OID)
.With(e => e.SeasonNumber = 1)
.Build();
@ -198,7 +198,7 @@ public void multiple_missing_episodes()
var episodes = Builder<Episode>.CreateListOfSize(10)
.TheFirst(5)
.With(e => e.Series = series)
.With(e => e.SeriesId = series.SeriesId)
.With(e => e.SeriesId = series.OID)
.With(e => e.SeasonNumber = 1)
.TheNext(5)
.With(e => e.Series = series2)

View File

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

View File

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

View File

@ -26,8 +26,8 @@ public void import_new_series_succesful()
{
var series = Builder<Series>.CreateListOfSize(2)
.All().With(s => s.LastInfoSync = null)
.TheFirst(1).With(s => s.SeriesId = 12)
.TheNext(1).With(s => s.SeriesId = 15)
.TheFirst(1).With(s => s.OID = 12)
.TheNext(1).With(s => s.OID = 15)
.Build();
var notification = new ProgressNotification("Test");
@ -40,11 +40,11 @@ public void import_new_series_succesful()
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);
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);
Mocker.GetMock<BannerDownloadJob>()
@ -54,18 +54,18 @@ public void import_new_series_succesful()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") > 0)));
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);
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);
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>()
.Setup(s => s.Get(series[1].SeriesId)).Returns(series[1]);
.Setup(s => s.Get(series[1].OID)).Returns(series[1]);
Mocker.GetMock<MediaFileProvider>()
.Setup(s => s.GetSeriesFiles(It.IsAny<int>())).Returns(new List<EpisodeFile>());
@ -74,11 +74,11 @@ public void import_new_series_succesful()
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].SeriesId)), 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[0].OID)), 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[1].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].OID)), Times.Once());
}
@ -91,8 +91,8 @@ public void failed_import_should_not_be_stuck_in_loop()
{
var series = Builder<Series>.CreateListOfSize(2)
.All().With(s => s.LastInfoSync = null)
.TheFirst(1).With(s => s.SeriesId = 12)
.TheNext(1).With(s => s.SeriesId = 15)
.TheFirst(1).With(s => s.OID = 12)
.TheNext(1).With(s => s.OID = 15)
.Build();
var notification = new ProgressNotification("Test");
@ -104,37 +104,37 @@ public void failed_import_should_not_be_stuck_in_loop()
.Returns(series);
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);
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());
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);
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>()
.Setup(s => s.Get(series[0].SeriesId)).Returns(series[0]);
.Setup(s => s.Get(series[0].OID)).Returns(series[0]);
Mocker.GetMock<MediaFileProvider>()
.Setup(s => s.GetSeriesFiles(It.IsAny<int>())).Returns(new List<EpisodeFile>());
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
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].SeriesId)), 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[0].OID)), 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);

View File

@ -37,11 +37,11 @@ public void Setup()
.Build();
Mocker.GetMock<ISeriesRepository>()
.Setup(s => s.Get(_series.SeriesId))
.Setup(s => s.Get(_series.OID))
.Returns(_series);
Mocker.GetMock<MediaFileProvider>()
.Setup(s => s.GetSeasonFiles(_series.SeriesId, 5))
.Setup(s => s.GetSeasonFiles(_series.OID, 5))
.Returns(_episodeFiles);
}
@ -63,13 +63,13 @@ public void should_throw_if_seriesId_is_zero()
public void should_throw_if_seasonId_is_less_than_zero()
{
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]
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);
}
@ -77,7 +77,7 @@ public void should_log_warning_if_no_episode_files_are_found()
[Test]
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());
}
@ -86,7 +86,7 @@ public void should_return_if_no_episodes_are_moved()
public void should_return_process_metadata_if_files_are_moved()
{
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());
}

View File

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

View File

@ -81,7 +81,7 @@ public void should_move_file_if_a_conflict_is_found()
.Build();
var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = seriesId)
.With(s => s.OID = seriesId)
.With(s => s.Title = "The Office")
.Build();

View File

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

View File

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

View File

@ -39,7 +39,7 @@ public void Setup()
series = Builder<Series>
.CreateNew()
.With(s => s.SeriesId == 79488)
.With(s => s.OID == 79488)
.With(s => s.Title == "30 Rock")
.Build();

View File

@ -37,7 +37,7 @@ public void Setup()
series = Builder<Series>
.CreateNew()
.With(s => s.SeriesId == 79488)
.With(s => s.OID == 79488)
.With(s => s.Title == "30 Rock")
.Build();

View File

@ -72,7 +72,7 @@ private void WithImportedFiles(string droppedFolder)
{
var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
.All()
.With(f => f.SeriesId = fakeSeries.SeriesId)
.With(f => f.SeriesId = fakeSeries.OID)
.Build().ToList();
Mocker.GetMock<DiskScanProvider>().Setup(s => s.Scan(fakeSeries, droppedFolder)).Returns(fakeEpisodeFiles);
@ -224,7 +224,7 @@ public void when_no_file_are_imported_and_folder_size_isnt_small_enought_folder_
var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
.All()
.With(f => f.SeriesId = fakeSeries.SeriesId)
.With(f => f.SeriesId = fakeSeries.OID)
.Build().ToList();
//Act

View File

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

View File

@ -138,11 +138,11 @@ public void UpdateDailySeries_should_update_series_should_skip_series_that_dont_
.All()
.With(s => s.SeriesType = SeriesType.Standard)
.TheFirst(1)
.With(s => s.SeriesId = 10)
.With(s => s.OID = 10)
.TheNext(1)
.With(s => s.SeriesId = 11)
.With(s => s.OID = 11)
.TheNext(1)
.With(s => s.SeriesId = 12)
.With(s => s.OID = 12)
.Build();
Db.InsertMany(fakeSeries);
@ -170,12 +170,12 @@ public void UpdateDailySeries_should_update_series_should_not_overwrite_existing
.All()
.With(s => s.SeriesType = SeriesType.Standard)
.TheFirst(1)
.With(s => s.SeriesId = 10)
.With(s => s.OID = 10)
.With(s => s.SeriesType = SeriesType.Daily)
.TheNext(1)
.With(s => s.SeriesId = 11)
.With(s => s.OID = 11)
.TheNext(1)
.With(s => s.SeriesId = 12)
.With(s => s.OID = 12)
.Build();
Db.InsertMany(fakeSeries);

View File

@ -45,7 +45,7 @@ public void Setup()
_searchHistory = Builder<SearchHistory>.CreateNew()
.With(h => h.EpisodeId = _episode.OID)
.With(h => h.SeriesId - _series.SeriesId)
.With(h => h.SeriesId - _series.OID)
.With(h => h.SearchHistoryItems = items)
.Build();
}

View File

@ -33,7 +33,7 @@ public void Setup()
_episode = Builder<Episode>
.CreateNew()
.With(e => e.SeriesId = _series.SeriesId)
.With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series)
.Build();

View File

@ -33,7 +33,7 @@ public void Setup()
_episode = Builder<Episode>
.CreateNew()
.With(e => e.SeriesId = _series.SeriesId)
.With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series)
.Build();

View File

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

View File

@ -34,7 +34,7 @@ public void Setup()
_episodes = Builder<Episode>
.CreateListOfSize(10)
.All()
.With(e => e.SeriesId = _series.SeriesId)
.With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series)
.Build()
.ToList();

View File

@ -36,14 +36,14 @@ public void Setup()
_episode = Builder<Episode>
.CreateNew()
.With(e => e.SeriesId = _series.SeriesId)
.With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series)
.Build();
_episodes = Builder<Episode>
.CreateListOfSize(10)
.All()
.With(e => e.SeriesId = _series.SeriesId)
.With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series)
.Build()
.ToList();

View File

@ -36,12 +36,12 @@ public class ProcessResultsFixture : TestBase
public void Setup()
{
_matchingSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();
_mismatchedSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12345)
.With(s => s.OID = 12345)
.With(s => s.Title = "Not 30 Rock")
.Build();

View File

@ -46,11 +46,11 @@ public void Setup()
.Build();
Mocker.GetMock<IEpisodeService>()
.Setup(s => s.GetEpisode(_series.SeriesId, 1, 1))
.Setup(s => s.GetEpisode(_series.OID, 1, 1))
.Returns(_episode);
Mocker.GetMock<SceneMappingProvider>()
.Setup(s => s.GetCleanName(_series.SeriesId))
.Setup(s => s.GetCleanName(_series.OID))
.Returns("");
Mocker.GetMock<TvRageProvider>()

View File

@ -43,7 +43,7 @@ public void Setup()
.Build();
series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 1)
.With(s => s.OID = 1)
.And(c => c.Monitored = true)
.Build();
@ -71,7 +71,7 @@ public void Get_UpcomingEpisodes()
//Assert
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]

View File

@ -465,7 +465,7 @@ public void UpdateWithHttp_Single()
var url = "http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video,smb://xbmc:xbmc@HOMESERVER/TV/30 Rock/))";
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();
@ -491,7 +491,7 @@ public void UpdateWithHttp_All()
var url = "http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video))";
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();
@ -519,7 +519,7 @@ public void UpdateWithJsonBuiltIn_Single()
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()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();
@ -552,7 +552,7 @@ public void UpdateWithJsonBuiltIn_All()
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()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();
@ -585,7 +585,7 @@ public void UpdateWithJsonVideoLibraryScan_Single()
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()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();
@ -617,7 +617,7 @@ public void UpdateWithJsonVideoLibraryScan_All()
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()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();

View File

@ -50,7 +50,7 @@ public void GetEpisodes_by_season_episode_exists()
WithRealDb();
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 1)
.With(s => s.OID = 1)
.Build();
var fakeEpisodes = Builder<Episode>.CreateNew()
.With(e => e.SeriesId = 1)
@ -61,7 +61,7 @@ public void GetEpisodes_by_season_episode_exists()
Db.Insert(fakeEpisodes);
//Act
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(fakeSeries.SeriesId, 2, 1);
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(fakeSeries.OID, 2, 1);
//Assert
episode.ShouldHave().AllPropertiesBut(e => e.Series).EqualTo(fakeEpisodes);
@ -128,7 +128,7 @@ public void GetEpisodesBySeason_success()
WithRealDb();
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12)
.With(s => s.OID = 12)
.Build();
var episodes = Builder<Episode>.CreateListOfSize(10)
@ -162,7 +162,7 @@ public void RefreshEpisodeInfo_emptyRepo()
.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();
@ -196,7 +196,7 @@ public void RefreshEpisodeInfo_should_set_older_than_1900_to_null()
.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();
@ -237,7 +237,7 @@ public void RefreshEpisodeInfo_should_set_older_than_1900_to_null_for_existing_e
.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();
Db.Insert(fakeSeries);
@ -274,7 +274,7 @@ public void RefreshEpisodeInfo_ignore_episode_zero()
.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();
@ -313,7 +313,7 @@ public void RefreshEpisodeInfo_should_skip_future_episodes_with_no_title()
.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();
@ -351,7 +351,7 @@ public void RefreshEpisodeInfo_should_skip_older_than_1900_year_episodes_with_no
.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();
@ -384,7 +384,7 @@ public void RefreshEpisodeInfo_should_add_future_episodes_with_title()
.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();
@ -417,7 +417,7 @@ public void RefreshEpisodeInfo_should_add_old_episodes_with_no_title()
.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();
@ -452,7 +452,7 @@ public void RefreshEpisodeInfo_ignore_season_zero()
.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();
@ -484,7 +484,7 @@ public void new_episodes_only_calls_Insert()
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).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>();
@ -515,7 +515,7 @@ public void existing_episodes_only_calls_Update()
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).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>();
foreach (var tvDbEpisode in tvdbSeries.Episodes)
@ -553,7 +553,7 @@ public void should_try_to_get_existing_episode_using_tvdbid_first()
)
.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 } };
Mocker.GetMock<IDatabase>()
@ -595,7 +595,7 @@ public void should_try_to_get_existing_episode_using_tvdbid_first_then_season_ep
.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)
.Setup(c => c.GetSeries(seriesId, true, false))
@ -621,7 +621,7 @@ public void existing_episodes_keep_their_episodeId_file_id()
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).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>();
foreach (var tvDbEpisode in tvdbSeries.Episodes)
@ -670,7 +670,7 @@ public void existing_episodes_remote_their_episodeId_file_id_when_episode_number
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).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>();
foreach (var tvDbEpisode in tvdbSeries.Episodes)
@ -716,7 +716,7 @@ public void existing_episodes_remote_their_episodeId_file_id_when_season_number_
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).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>();
foreach (var tvDbEpisode in tvdbSeries.Episodes)
@ -784,7 +784,7 @@ public void RefreshEpisodeInfo_should_ignore_new_episode_for_ignored_season()
.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();
@ -1121,7 +1121,7 @@ public void EpisodesWithoutFiles_no_specials()
WithRealDb();
var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 10)
.With(s => s.OID = 10)
.Build();
var episodes = Builder<Episode>.CreateListOfSize(4)
@ -1164,7 +1164,7 @@ public void EpisodesWithoutFiles_with_specials()
WithRealDb();
var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 10)
.With(s => s.OID = 10)
.Build();
var episodes = Builder<Episode>.CreateListOfSize(4)
@ -1208,7 +1208,7 @@ public void EpisodesWithFiles_success()
WithRealDb();
var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 10)
.With(s => s.OID = 10)
.Build();
var episodeFile = Builder<EpisodeFile>.CreateNew()
@ -1252,7 +1252,7 @@ public void EpisodesWithFiles_no_files()
WithRealDb();
var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 10)
.With(s => s.OID = 10)
.Build();
var episodes = Builder<Episode>.CreateListOfSize(2)
@ -1281,7 +1281,7 @@ public void GetEpisodesByFileId_multi_episodes()
WithRealDb();
var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 10)
.With(s => s.OID = 10)
.Build();
var fakeEpisodes = Builder<Episode>.CreateListOfSize(2)
@ -1308,7 +1308,7 @@ public void GetEpisodesByFileId_single_episode()
WithRealDb();
var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 10)
.With(s => s.OID = 10)
.Build();
var fakeEpisode = Builder<Episode>.CreateNew()
@ -1400,7 +1400,7 @@ public void SetPostDownloadStatus(string folderName, PostDownloadStatusType post
WithRealDb();
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12345)
.With(s => s.OID = 12345)
.With(s => s.CleanTitle = "officeus")
.Build();
@ -1432,7 +1432,7 @@ public void SetPostDownloadStatus_Invalid_EpisodeId()
var postDownloadStatus = PostDownloadStatusType.Failed;
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12345)
.With(s => s.OID = 12345)
.With(s => s.CleanTitle = "officeus")
.Build();
@ -1489,7 +1489,7 @@ public void RefreshEpisodeInfo_should_ignore_episode_zero_except_if_season_one()
.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();

View File

@ -29,7 +29,7 @@ public void Delete_None_Valid_TvDbEpisodeId()
var fakeSeries = Builder<Series>.CreateNew()
.With(c => c.SeriesId = seriesId)
.With(c => c.OID = seriesId)
.Build();
var fakeEpisode = Builder<Episode>.CreateNew()
@ -65,7 +65,7 @@ public void Delete_None_TvDbEpisodeId_is_zero()
.Build();
var fakeSeries = Builder<Series>.CreateNew()
.With(c => c.SeriesId = seriesId)
.With(c => c.OID = seriesId)
.Build();
var fakeEpisode = Builder<Episode>.CreateNew()
@ -101,7 +101,7 @@ public void Delete_None_TvDbEpisodeId_is_null()
.Build();
var fakeSeries = Builder<Series>.CreateNew()
.With(c => c.SeriesId = seriesId)
.With(c => c.OID = seriesId)
.Build();
var fakeEpisode = Builder<Episode>.CreateNew()
@ -135,7 +135,7 @@ public void Delete_TvDbId()
.Build();
var fakeSeries = Builder<Series>.CreateNew()
.With(c => c.SeriesId = seriesId)
.With(c => c.OID = seriesId)
.Build();
var fakeEpisode = Builder<Episode>.CreateNew()
@ -174,7 +174,7 @@ public void Delete_TvDbId_multiple_series()
.Build();
var fakeSeries = Builder<Series>.CreateNew()
.With(c => c.SeriesId = seriesId)
.With(c => c.OID = seriesId)
.Build();
var fakeEpisode = Builder<Episode>.CreateNew()
@ -186,7 +186,7 @@ public void Delete_TvDbId_multiple_series()
//Other Series
var otherFakeSeries = Builder<Series>.CreateNew()
.With(c => c.SeriesId = 12345)
.With(c => c.OID = 12345)
.Build();
var otherFakeEpisode = Builder<Episode>.CreateNew()

View File

@ -36,19 +36,19 @@ public void Setup()
.Build();
fakeEpisode = Builder<Episode>.CreateNew()
.With(e => e.SeriesId = fakeSeries.SeriesId)
.With(e => e.SeriesId = fakeSeries.OID)
.With(e => e.Title = "Episode (1)")
.Build();
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.EpisodeNumber = fakeEpisode.EpisodeNumber + 1)
.With(e => e.Title = "Episode (2)")
.Build();
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.Title = "Daily Episode 1")
.Build();

View File

@ -32,7 +32,7 @@ public void WithNullSceneNumbering()
{
_episode = Builder<Episode>
.CreateNew()
.With(e => e.SeriesId = _series.SeriesId)
.With(e => e.SeriesId = _series.OID)
.Build();
Db.Insert(_episode);
@ -43,7 +43,7 @@ public void WithSceneNumbering()
{
_episode = Builder<Episode>
.CreateNew()
.With(e => e.SeriesId = _series.SeriesId)
.With(e => e.SeriesId = _series.OID)
.Build();
Db.Insert(_episode);
@ -52,14 +52,14 @@ public void WithSceneNumbering()
[Test]
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]
public void should_return_null_if_no_matching_episode_is_found()
{
WithNullSceneNumbering();
Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.SeriesId, 1, 1).Should().BeNull();
Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.OID, 1, 1).Should().BeNull();
}
[Test]
@ -68,7 +68,7 @@ public void should_return_episode_if_matching_episode_is_found()
WithSceneNumbering();
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);
}

View File

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

View File

@ -30,7 +30,7 @@ public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
{
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)
{
logger.Trace("Comparing history quality with report. History is {0}", bestQualityInHistory);

View File

@ -27,7 +27,7 @@ public void Trim()
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);
if (history != null)

View File

@ -3,6 +3,7 @@
using System.IO;
using System.Linq;
using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -65,7 +66,7 @@ public void Start(ProgressNotification notification, dynamic options)
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)
{
return;
@ -75,20 +76,20 @@ private void ScanSeries(ProgressNotification notification)
{
try
{
_attemptedSeries.Add(currentSeries.OID);
_attemptedSeries.Add(((ModelBase)currentSeries).OID);
notification.CurrentMessage = String.Format("Searching for '{0}'", new DirectoryInfo(currentSeries.Path).Name);
_updateInfoJob.Start(notification, new { SeriesId = currentSeries.OID });
_diskScanJob.Start(notification, new { SeriesId = currentSeries.OID });
_updateInfoJob.Start(notification, new { SeriesId = ((ModelBase)currentSeries).OID });
_diskScanJob.Start(notification, new { SeriesId = ((ModelBase)currentSeries).OID });
var updatedSeries = _seriesRepository.Get(currentSeries.OID);
AutoIgnoreSeasons(updatedSeries.OID);
var updatedSeries = _seriesRepository.Get(((ModelBase)currentSeries).OID);
AutoIgnoreSeasons(((ModelBase)updatedSeries).OID);
//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
_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);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,6 +3,7 @@
using System.Linq;
using System.Text.RegularExpressions;
using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Download;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Tv;
@ -109,7 +110,7 @@ public virtual SearchHistory ProcessReports(Series series, dynamic options, List
logger.Trace("Analysing report " + episodeParseResult);
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;
continue;

View File

@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.TvRage;
using NzbDrone.Core.Repository;
@ -33,7 +34,7 @@ public Series FindMatchingTvRageSeries(Series series)
{
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 result = ProcessResults(results, series, cleanName, firstEpisode);

View File

@ -138,7 +138,7 @@ public virtual bool UpdateWithJsonExecBuiltIn(Series series, string host, string
Logger.Trace("Failed to get TV Shows from XBMC");
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);
@ -179,7 +179,7 @@ public virtual bool UpdateWithJsonVideoLibraryScan(Series series, string host, s
Logger.Trace("Failed to get TV Shows from XBMC");
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();
postJson.Add(new JProperty("jsonrpc", "2.0"));
@ -221,7 +221,7 @@ public virtual bool UpdateWithHttp(Series series, string host, string username,
try
{
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 (!String.IsNullOrEmpty(xbmcSeriesPath))

View File

@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Repository;
@ -37,7 +38,7 @@ public virtual void UpdateMappings()
{
var ids = _xemCommunicationProvider.GetXemSeriesIds();
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)
{
@ -81,7 +82,7 @@ public virtual void PerformUpdate(Series series)
try
{
var episodesToUpdate = new List<Episode>();
var mappings = _xemCommunicationProvider.GetSceneTvdbMappings(series.SeriesId);
var mappings = _xemCommunicationProvider.GetSceneTvdbMappings(series.OID);
if (mappings == null)
{

View File

@ -3,6 +3,7 @@
using System.Linq;
using NLog;
using NzbDrone.Common.Eventing;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Download;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
@ -94,7 +95,7 @@ public virtual IList<Episode> GetEpisodesByParseResult(EpisodeParseResult parseR
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)
{
@ -116,14 +117,14 @@ public virtual IList<Episode> GetEpisodesByParseResult(EpisodeParseResult parseR
Episode episodeInfo = null;
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)
{
episodeInfo = GetEpisode(parseResult.Series.OID, parseResult.SeasonNumber, episodeNumber);
episodeInfo = GetEpisode(((ModelBase)parseResult.Series).OID, parseResult.SeasonNumber, episodeNumber);
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 @@ public virtual void RefreshEpisodeInfo(Series series)
var successCount = 0;
var failCount = 0;
var tvdbEpisodes = _tvDbProvider.GetSeries(series.SeriesId, true)
var tvdbEpisodes = _tvDbProvider.GetSeries(series.OID, true)
.Episodes
.Where(episode => !string.IsNullOrWhiteSpace(episode.EpisodeName) ||
(episode.FirstAired < DateTime.Now.AddDays(2) && episode.FirstAired.Year > 1900))

View File

@ -19,7 +19,7 @@ public enum SeriesType
public class Series : ModelBase
{
public virtual int SeriesId { get; set; }
public int TvDbId { get; set; }
public string Title { get; set; }

View File

@ -6,6 +6,7 @@
using NzbDrone.Common.EnsureThat;
using NzbDrone.Common.Eventing;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
@ -58,8 +59,8 @@ public bool IsMonitored(int id)
public Series UpdateSeriesInfo(int 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.AirTime = CleanAirsTime(tvDbSeries.AirsTime);
series.AirsDayOfWeek = tvDbSeries.AirsDayOfWeek;
@ -118,7 +119,7 @@ public void AddSeries(string title, string path, int tvDbSeriesId, int qualityPr
Ensure.That(() => path).IsNotNullOrWhiteSpace();
var repoSeries = new Series();
repoSeries.SeriesId = tvDbSeriesId;
repoSeries.TvDbId = tvDbSeriesId;
repoSeries.Path = path;
repoSeries.Monitored = true;
repoSeries.QualityProfileId = qualityProfileId;
@ -145,7 +146,7 @@ public void UpdateFromSeriesEditor(IList<Series> editedSeries)
foreach (var series in allSeries)
{
//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.Monitored = edited.Monitored;
series.SeasonFolder = edited.SeasonFolder;