add series works again, now includes title.

This commit is contained in:
Keivan Beigi 2013-02-25 19:58:57 -08:00
parent 9ed7c03d48
commit 94daf08361
80 changed files with 303 additions and 284 deletions

3
.gitignore vendored
View File

@ -133,4 +133,5 @@ UpdateLogs/
*.sqo *.sqo
*.userprefs *.userprefs
*/test-results/* */test-results/*
.idea/* .idea/*
NzbDrone.Web/*

View File

@ -40,7 +40,7 @@ namespace NzbDrone.Api
//Series //Series
Mapper.CreateMap<Core.Tv.Series, SeriesResource>() Mapper.CreateMap<Core.Tv.Series, SeriesResource>()
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.OID)) .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.CustomStartDate, opt => opt.ResolveUsing<NullableDatetimeToString>().FromMember(src => src.CustomStartDate)) .ForMember(dest => dest.CustomStartDate, opt => opt.ResolveUsing<NullableDatetimeToString>().FromMember(src => src.CustomStartDate))
.ForMember(dest => dest.BacklogSetting, opt => opt.MapFrom(src => (Int32)src.BacklogSetting)) .ForMember(dest => dest.BacklogSetting, opt => opt.MapFrom(src => (Int32)src.BacklogSetting))
.ForMember(dest => dest.NextAiring, opt => opt.ResolveUsing<NextAiringResolver>()); .ForMember(dest => dest.NextAiring, opt => opt.ResolveUsing<NextAiringResolver>());

View File

@ -59,7 +59,7 @@ namespace NzbDrone.Api.Series
//(we can just create the folder and it won't blow up if it already exists) //(we can just create the folder and it won't blow up if it already exists)
//We also need to remove any special characters from the filename before attempting to create it //We also need to remove any special characters from the filename before attempting to create it
_seriesService.AddSeries("", request.Path, request.OID, request.QualityProfileId, null); _seriesService.AddSeries(request.Title, request.Path, request.TvDbId, request.QualityProfileId, null);
_jobProvider.QueueJob(typeof(ImportNewSeriesJob)); _jobProvider.QueueJob(typeof(ImportNewSeriesJob));
return new Response { StatusCode = HttpStatusCode.Created }; return new Response { StatusCode = HttpStatusCode.Created };
@ -89,7 +89,7 @@ namespace NzbDrone.Api.Series
_seriesRepository.Update(series); _seriesRepository.Update(series);
if (oldPath != series.Path) if (oldPath != series.Path)
_jobProvider.QueueJob(typeof(DiskScanJob), new { SeriesId = series.OID }); _jobProvider.QueueJob(typeof(DiskScanJob), new { SeriesId = series.Id });
_seriesRepository.Update(series); _seriesRepository.Update(series);
@ -117,7 +117,7 @@ namespace NzbDrone.Api.Series
{ {
RuleSet("POST", () => RuleSet("POST", () =>
{ {
RuleFor(s => ((ModelBase)s).OID).GreaterThan(0); RuleFor(s => ((ModelBase)s).Id).GreaterThan(0);
RuleFor(s => s.Path).NotEmpty().Must(_diskProvider.FolderExists); RuleFor(s => s.Path).NotEmpty().Must(_diskProvider.FolderExists);
RuleFor(s => s.QualityProfileId).GreaterThan(0); RuleFor(s => s.QualityProfileId).GreaterThan(0);
}); });

View File

@ -1,5 +1,9 @@
<div class="line row folder-match-result-view"> <div class="line row folder-match-result-view">
<a href="http://thetvdb.com/?tab=series&id={{id}}" target="_blank" class="icon-info-sign"></a>
<span>{{seriesName}} {{seriesYear}}</span> <div class="span6">
<span class="icon-plus pull-right btn btn-success x-btn-add"></span> {{title}} {{seriesYear}}
</div>
<div class="btn btn-success x-btn-add">
<icon class="icon-plus "></icon>
</div>
</div> </div>

View File

@ -15,13 +15,13 @@ define([
var self = this; var self = this;
var seriesId = this.model.get('id'); var seriesId = this.model.get('tvDbId');
var title = this.model.get('seriesName'); var title = this.model.get('title');
var quality = this.options.qualityProfile.val(); var quality = this.options.qualityProfile.val();
var path = this.options.folder.path; var path = this.options.folder.path;
var model = new NzbDrone.Series.SeriesModel({ var model = new NzbDrone.Series.SeriesModel({
seriesId:seriesId, tvDbId: seriesId,
title:title, title:title,
qualityProfileId:quality, qualityProfileId:quality,
path:path path:path
@ -34,6 +34,7 @@ define([
model.save(undefined, { model.save(undefined, {
success:function () { success:function () {
var notificationModel = new NzbDrone.Shared.NotificationModel({ var notificationModel = new NzbDrone.Shared.NotificationModel({
tvDbId: seriesId,
title:'Added', title:'Added',
message:title, message:title,
level:'success' level:'success'

View File

@ -11,7 +11,7 @@
<icon class="icon-search "></icon> <icon class="icon-search "></icon>
</div> </div>
<div class="row"> <div class="row">
<div class="x-folder-name-match-results span11" /> <div class="x-folder-name-match-results folder-name-matches span11" />
</div> </div>
</div> </div>

View File

@ -1,9 +1,9 @@
<div class="accordion-group"> <div class="accordion-group">
<div class="accordion-heading"> <div class="accordion-heading">
<a href="http://thetvdb.com/?tab=series&id={{id}}" target="_blank" class="icon-info-sign pull-left"></a> <a href="http://thetvdb.com/?tab=series&id={{tvDbId}}" target="_blank" class="icon-info-sign pull-left"></a>
<a class="accordion-toggle" data-toggle="collapse" href="#{{id}}">{{seriesName}} {{seriesYear}}</a> <a class="accordion-toggle" data-toggle="collapse" href="#{{tvDbId}}">{{title}} {{seriesYear}}</a>
</div> </div>
<div id="{{id}}" class="accordion-body collapse"> <div id="{{tvDbId}}" class="accordion-body collapse">
<div class="accordion-inner"> <div class="accordion-inner">
<select class="span7 x-root-folder"> <select class="span7 x-root-folder">
{{#each rootFolders.models}} {{#each rootFolders.models}}

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
define(['app','Shared/NotificationCollection', 'AddSeries/SearchResultCollection', 'AddSeries/SearchResultModel', 'Series/SeriesCollection'], function (app,notificationCollection) { define(['app', 'Shared/NotificationCollection', 'AddSeries/SearchResultCollection', 'AddSeries/SearchResultModel', 'Series/SeriesCollection'], function (app, notificationCollection) {
NzbDrone.AddSeries.New.SearchItemView = Backbone.Marionette.ItemView.extend({ NzbDrone.AddSeries.New.SearchItemView = Backbone.Marionette.ItemView.extend({
template: "AddSeries/New/SearchResultTemplate", template: "AddSeries/New/SearchResultTemplate",
@ -23,8 +23,8 @@ define(['app','Shared/NotificationCollection', 'AddSeries/SearchResultCollection
add: function () { add: function () {
var seriesId = this.model.get('id'); var seriesId = this.model.get('tvDbId');
var title = this.model.get('seriesName'); var title = this.model.get('title');
var quality = this.ui.qualityProfile.val(); var quality = this.ui.qualityProfile.val();
var rootFolderId = this.ui.rootFolder.val(); var rootFolderId = this.ui.rootFolder.val();
@ -33,7 +33,7 @@ define(['app','Shared/NotificationCollection', 'AddSeries/SearchResultCollection
var path = rootPath + "\\" + title; var path = rootPath + "\\" + title;
var model = new NzbDrone.Series.SeriesModel({ var model = new NzbDrone.Series.SeriesModel({
seriesId: seriesId, tvdbId: seriesId,
title: title, title: title,
qualityProfileId: quality, qualityProfileId: quality,
path: path path: path
@ -41,7 +41,7 @@ define(['app','Shared/NotificationCollection', 'AddSeries/SearchResultCollection
var self = this; var self = this;
var seriesCollection = new NzbDrone.Series.SeriesCollection(); var seriesCollection = new NzbDrone.Series.SeriesCollection();
seriesCollection.push(model); seriesCollection.push(model);
model.save(undefined, { model.save(undefined, {

View File

@ -7,7 +7,7 @@
var date = Date.utc.create(this.get('firstAired')).format('({yyyy})'); var date = Date.utc.create(this.get('firstAired')).format('({yyyy})');
//don't append year, if the series name already has the name appended. //don't append year, if the series name already has the name appended.
if (this.get('seriesName').endsWith(date)) { if (this.get('title').endsWith(date)) {
return ""; return "";
} else { } else {
return date; return date;

View File

@ -21,12 +21,12 @@ namespace NzbDrone.Core.Test.Datastore
{ {
childModel = Builder<ChildModel> childModel = Builder<ChildModel>
.CreateNew() .CreateNew()
.With(s => s.OID = 0) .With(s => s.Id = 0)
.Build(); .Build();
ParentModel = Builder<ParentModel> ParentModel = Builder<ParentModel>
.CreateNew() .CreateNew()
.With(e => e.OID = 0) .With(e => e.Id = 0)
.Build(); .Build();
} }
@ -48,7 +48,7 @@ namespace NzbDrone.Core.Test.Datastore
[Test] [Test]
public void update_item_with_root_index_0_should_faile() public void update_item_with_root_index_0_should_faile()
{ {
childModel.OID = 0; childModel.Id = 0;
Assert.Throws<InvalidOperationException>(() => Db.Update(childModel)); Assert.Throws<InvalidOperationException>(() => Db.Update(childModel));
} }
@ -89,7 +89,7 @@ namespace NzbDrone.Core.Test.Datastore
{ {
ParentModel.Child = Builder<ChildModel> ParentModel.Child = Builder<ChildModel>
.CreateNew() .CreateNew()
.With(s => s.OID = 0) .With(s => s.Id = 0)
.Build(); .Build();
Db.Insert(ParentModel); Db.Insert(ParentModel);
@ -106,19 +106,19 @@ namespace NzbDrone.Core.Test.Datastore
[Test] [Test]
public void new_objects_should_get_id() public void new_objects_should_get_id()
{ {
childModel.OID = 0; childModel.Id = 0;
Db.Insert(childModel); Db.Insert(childModel);
childModel.OID.Should().NotBe(0); childModel.Id.Should().NotBe(0);
} }
[Test] [Test]
public void new_object_should_get_new_id() public void new_object_should_get_new_id()
{ {
childModel.OID = 0; childModel.Id = 0;
Db.Insert(childModel); Db.Insert(childModel);
Db.AsQueryable<ChildModel>().Should().HaveCount(1); Db.AsQueryable<ChildModel>().Should().HaveCount(1);
childModel.OID.Should().Be(1); childModel.Id.Should().Be(1);
} }
@ -131,31 +131,31 @@ namespace NzbDrone.Core.Test.Datastore
Db.Insert(nested); Db.Insert(nested);
nested.OID.Should().Be(1); nested.Id.Should().Be(1);
nested.List.Should().OnlyContain(c => c.OID > 0); nested.List.Should().OnlyContain(c => c.Id > 0);
} }
[Test] [Test]
public void should_have_id_when_returned_from_database() public void should_have_id_when_returned_from_database()
{ {
childModel.OID = 0; childModel.Id = 0;
Db.Insert(childModel); Db.Insert(childModel);
var item = Db.AsQueryable<ChildModel>(); var item = Db.AsQueryable<ChildModel>();
item.Should().HaveCount(1); item.Should().HaveCount(1);
item.First().OID.Should().NotBe(0); item.First().Id.Should().NotBe(0);
item.First().OID.Should().BeLessThan(100); item.First().Id.Should().BeLessThan(100);
item.First().OID.Should().Be(childModel.OID); item.First().Id.Should().Be(childModel.Id);
} }
[Test] [Test]
public void should_be_able_to_find_object_by_id() public void should_be_able_to_find_object_by_id()
{ {
Db.Insert(childModel); Db.Insert(childModel);
var item = Db.AsQueryable<ChildModel>().Single(c => c.OID == childModel.OID); var item = Db.AsQueryable<ChildModel>().Single(c => c.Id == childModel.Id);
item.OID.Should().NotBe(0); item.Id.Should().NotBe(0);
item.OID.Should().Be(childModel.OID); item.Id.Should().Be(childModel.Id);
} }
[Test] [Test]

View File

@ -27,7 +27,7 @@ namespace NzbDrone.Core.Test.Datastore
{ {
sampleType = Builder<SampleType> sampleType = Builder<SampleType>
.CreateNew() .CreateNew()
.With(c => c.OID = 0) .With(c => c.Id = 0)
.Build(); .Build();
} }
@ -47,7 +47,7 @@ namespace NzbDrone.Core.Test.Datastore
Subject.Insert(sampleType); Subject.Insert(sampleType);
Subject.All().Should().HaveCount(1); Subject.All().Should().HaveCount(1);
Subject.Delete(sampleType.OID); Subject.Delete(sampleType.Id);
Subject.All().Should().BeEmpty(); Subject.All().Should().BeEmpty();
} }
@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.Datastore
public void should_be_able_to_find_by_id() public void should_be_able_to_find_by_id()
{ {
Subject.Insert(sampleType); Subject.Insert(sampleType);
Subject.Get(sampleType.OID) Subject.Get(sampleType.Id)
.ShouldHave() .ShouldHave()
.AllProperties() .AllProperties()
.EqualTo(sampleType); .EqualTo(sampleType);

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<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 3)).Returns(firstQuality); Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 3)).Returns(firstQuality);
Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 4)).Returns(secondQuality); Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 4)).Returns(secondQuality);
Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 5)).Returns<QualityModel>(null); Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 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<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 3)).Returns(firstQuality); Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 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.OID) .With(e => e.SeriesId = _series.Id)
.With(e => e.Series = _series) .With(e => e.Series = _series)
.With(e => e.EpisodeFile = _episodeFile) .With(e => e.EpisodeFile = _episodeFile)
.Build(); .Build();

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Core.Test.HistoryTests
{ {
var historyItem = Builder<History.History>.CreateListOfSize(30) var historyItem = Builder<History.History>.CreateListOfSize(30)
.All() .All()
.With(c=>c.OID = 0) .With(c=>c.Id = 0)
.TheFirst(10).With(c => c.Date = DateTime.Now) .TheFirst(10).With(c => c.Date = DateTime.Now)
.TheNext(20).With(c => c.Date = DateTime.Now.AddDays(-31)) .TheNext(20).With(c => c.Date = DateTime.Now.AddDays(-31))
.Build(); .Build();
@ -46,13 +46,13 @@ namespace NzbDrone.Core.Test.HistoryTests
var series = Builder<Series>.CreateNew().Build(); var series = Builder<Series>.CreateNew().Build();
var episode = Builder<Episode>.CreateNew() var episode = Builder<Episode>.CreateNew()
.With(c => c.Series = series) .With(c => c.Series = series)
.With(c => c.SeriesId = series.OID) .With(c => c.SeriesId = series.Id)
.Build(); .Build();
var history = Builder<History.History>.CreateNew() var history = Builder<History.History>.CreateNew()
.With(c => c.OID = 0) .With(c => c.Id = 0)
.With(h => h.Quality = new QualityModel(QualityTypes.Bluray720p, true)) .With(h => h.Quality = new QualityModel(QualityTypes.Bluray720p, true))
.With(h => h.Episode = episode) .With(h => h.Episode = episode)
.Build(); .Build();
@ -73,14 +73,14 @@ namespace NzbDrone.Core.Test.HistoryTests
var series = Builder<Series>.CreateNew().Build(); var series = Builder<Series>.CreateNew().Build();
var episode = Builder<Episode>.CreateNew() var episode = Builder<Episode>.CreateNew()
.With(c => c.Series = series) .With(c => c.Series = series)
.With(c => c.SeriesId = series.OID) .With(c => c.SeriesId = series.Id)
.Build(); .Build();
var history = Builder<History.History> var history = Builder<History.History>
.CreateListOfSize(5) .CreateListOfSize(5)
.All() .All()
.With(c => c.OID = 0) .With(c => c.Id = 0)
.With(h => h.Episode = episode) .With(h => h.Episode = episode)
.TheFirst(1) .TheFirst(1)
.With(h => h.Quality = new QualityModel(QualityTypes.DVD, true)) .With(h => h.Quality = new QualityModel(QualityTypes.DVD, true))

View File

@ -40,7 +40,7 @@ namespace NzbDrone.Core.Test.Indexers
Mocker.GetMock<IIndexerRepository>() Mocker.GetMock<IIndexerRepository>()
.Setup(s => s.All()) .Setup(s => s.All())
.Returns(new List<Indexer> {new Indexer {OID = 1, Type = "", Enable = false, Name = "Fake Indexer"}}); .Returns(new List<Indexer> {new Indexer {Id = 1, Type = "", Enable = false, Name = "Fake Indexer"}});
Subject.GetEnabledIndexers().Should().BeEmpty(); Subject.GetEnabledIndexers().Should().BeEmpty();
} }

View File

@ -21,14 +21,14 @@ namespace NzbDrone.Core.Test.Indexers
{ {
Mocker.GetMock<INewznabRepository>() Mocker.GetMock<INewznabRepository>()
.Setup(s => s.All()) .Setup(s => s.All())
.Returns(new List<NewznabDefinition>{new NewznabDefinition { OID = 1, Name = "", Url = "http://www.nzbdrone.com" }}); .Returns(new List<NewznabDefinition>{new NewznabDefinition { Id = 1, Name = "", Url = "http://www.nzbdrone.com" }});
} }
private void WithExisting() private void WithExisting()
{ {
Mocker.GetMock<INewznabRepository>() Mocker.GetMock<INewznabRepository>()
.Setup(s => s.All()) .Setup(s => s.All())
.Returns(new List<NewznabDefinition> { new NewznabDefinition { OID = 1, Name = "Nzbs.org", Url = "http://nzbs.org" } }); .Returns(new List<NewznabDefinition> { new NewznabDefinition { Id = 1, Name = "Nzbs.org", Url = "http://nzbs.org" } });
} }
[Test] [Test]

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.OID) .With(e => e.SeriesId = series.Id)
.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.OID) .With(e => e.SeriesId = series.Id)
.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.OID)) Mocker.GetMock<ISeriesRepository>().Setup(s => s.Get(series.Id))
.Returns(series); .Returns(series);
Mocker.Resolve<BannerDownloadJob>().Start(_notification, new { SeriesId = series.OID }); Mocker.Resolve<BannerDownloadJob>().Start(_notification, new { SeriesId = series.Id });
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.OID = 12) .With(s => s.Id = 12)
.Build(); .Build();
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
.Setup(p => p.Get(series.OID)); .Setup(p => p.Get(series.Id));
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.OID }); Mocker.Resolve<DiskScanJob>().Start(new ProgressNotification("Test"), new { SeriesId = series.Id });
//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.OID = 12) .TheFirst(1).With(s => s.Id = 12)
.TheNext(1).With(s => s.OID = 15) .TheNext(1).With(s => s.Id = 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.OID = 12) .TheFirst(1).With(s => s.Id = 12)
.TheNext(1).With(s => s.OID = 15) .TheNext(1).With(s => s.Id = 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.OID = 12) .TheFirst(1).With(s => s.Id = 12)
.TheNext(1).With(s => s.OID = 15) .TheNext(1).With(s => s.Id = 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.OID = 12) .TheFirst(1).With(s => s.Id = 12)
.TheNext(1).With(s => s.OID = 15) .TheNext(1).With(s => s.Id = 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].OID))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)))
.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].OID))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].Id)))
.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].OID))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)))
.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].OID))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].Id)))
.Callback(() => series[1].LastInfoSync = DateTime.Now); .Callback(() => series[1].LastInfoSync = DateTime.Now);
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
.Setup(s => s.Get(series[0].OID)).Returns(series[0]); .Setup(s => s.Get(series[0].Id)).Returns(series[0]);
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
.Setup(s => s.Get(series[1].OID)).Returns(series[1]); .Setup(s => s.Get(series[1].Id)).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].OID)), Times.Once()); Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)), Times.Once());
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)), Times.Once()); Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].Id)), 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[0].Id)), 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<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].Id)), 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.OID = 12) .TheFirst(1).With(s => s.Id = 12)
.TheNext(1).With(s => s.OID = 15) .TheNext(1).With(s => s.Id = 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].OID))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)))
.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].OID))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].Id)))
.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].OID))) .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)))
.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].OID))); .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)));
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
.Setup(s => s.Get(series[0].OID)).Returns(series[0]); .Setup(s => s.Get(series[0].Id)).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].OID))); .Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)));
//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].OID)), Times.Once()); Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)), Times.Once());
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)), Times.Once()); Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].Id)), 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[0].Id)), Times.Once());
ExceptionVerification.ExpectedErrors(1); ExceptionVerification.ExpectedErrors(1);

View File

@ -59,7 +59,7 @@ namespace NzbDrone.Core.Test.JobTests
Subject.Init(); Subject.Init();
var deletedJob = Builder<JobDefinition>.CreateNew() var deletedJob = Builder<JobDefinition>.CreateNew()
.With(c => c.OID = 0) .With(c => c.Id = 0)
.Build(); .Build();
Db.Insert(deletedJob); Db.Insert(deletedJob);
@ -80,7 +80,7 @@ namespace NzbDrone.Core.Test.JobTests
var deletedJob = Builder<JobDefinition>.CreateNew() var deletedJob = Builder<JobDefinition>.CreateNew()
.With(c => c.Name = _fakeJob.Name) .With(c => c.Name = _fakeJob.Name)
.With(c => c.OID = 0) .With(c => c.Id = 0)
.Build(); .Build();
@ -99,7 +99,7 @@ namespace NzbDrone.Core.Test.JobTests
{ {
var oldJob = Builder<JobDefinition>.CreateNew() var oldJob = Builder<JobDefinition>.CreateNew()
.With(c => c.OID = 0) .With(c => c.Id = 0)
.With(c => c.Name = "OldName") .With(c => c.Name = "OldName")
.With(c => c.TypeName = typeof(FakeJob).ToString()) .With(c => c.TypeName = typeof(FakeJob).ToString())
.With(c => c.Interval = 0) .With(c => c.Interval = 0)

View File

@ -37,11 +37,11 @@ namespace NzbDrone.Core.Test.JobTests
.Build(); .Build();
Mocker.GetMock<ISeriesRepository>() Mocker.GetMock<ISeriesRepository>()
.Setup(s => s.Get(_series.OID)) .Setup(s => s.Get(_series.Id))
.Returns(_series); .Returns(_series);
Mocker.GetMock<MediaFileProvider>() Mocker.GetMock<MediaFileProvider>()
.Setup(s => s.GetSeasonFiles(_series.OID, 5)) .Setup(s => s.GetSeasonFiles(_series.Id, 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.OID, SeasonNumber = -10 })); Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.Id, 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.OID, SeasonNumber = 10 }); Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.Id, 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.OID, SeasonNumber = 5 }); Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.Id, 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.OID, SeasonNumber = 5 }); Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.Id, 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.OID = 12345) .With(s => s.Id = 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.OID = seriesId) .With(s => s.Id = seriesId)
.With(s => s.Title = "The Office") .With(s => s.Title = "The Office")
.Build(); .Build();

View File

@ -29,13 +29,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.OID = 5) .With(s => s.Id = 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.OID) .With(e => e.SeriesId = fakeSeries.Id)
.With(e => e.SeasonNumber = 1) .With(e => e.SeasonNumber = 1)
.With(e => e.EpisodeNumber = 1) .With(e => e.EpisodeNumber = 1)
.Build(); .Build();
@ -44,12 +44,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.OID) .With(f => f.SeriesId = fakeSeries.Id)
.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.OID)) .Setup(e => e.Get(fakeSeries.Id))
.Returns(fakeSeries); .Returns(fakeSeries);
Mocker.GetMock<IEpisodeService>() Mocker.GetMock<IEpisodeService>()
@ -75,13 +75,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.OID = 5) .With(s => s.Id = 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.OID) .With(e => e.SeriesId = fakeSeries.Id)
.With(e => e.SeasonNumber = 1) .With(e => e.SeasonNumber = 1)
.With(e => e.EpisodeNumber = 1) .With(e => e.EpisodeNumber = 1)
.Build(); .Build();
@ -92,14 +92,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.OID) .With(f => f.SeriesId = fakeSeries.Id)
.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.OID)) .Setup(e => e.Get(fakeSeries.Id))
.Returns(fakeSeries); .Returns(fakeSeries);
Mocker.GetMock<IEpisodeService>() Mocker.GetMock<IEpisodeService>()
@ -127,13 +127,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.OID = 5) .With(s => s.Id = 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.OID) .With(e => e.SeriesId = fakeSeries.Id)
.With(e => e.SeasonNumber = 1) .With(e => e.SeasonNumber = 1)
.With(e => e.EpisodeNumber = 1) .With(e => e.EpisodeNumber = 1)
.Build(); .Build();
@ -144,14 +144,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.OID) .With(f => f.SeriesId = fakeSeries.Id)
.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.OID)) .Setup(e => e.Get(fakeSeries.Id))
.Returns(fakeSeries); .Returns(fakeSeries);
Mocker.GetMock<IEpisodeService>() Mocker.GetMock<IEpisodeService>()

View File

@ -32,8 +32,8 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests
private EpisodeParseResult SetupParseResult() private EpisodeParseResult SetupParseResult()
{ {
var episodes = Builder<Episode>.CreateListOfSize(2) var episodes = Builder<Episode>.CreateListOfSize(2)
.TheFirst(1).With(s => s.OID = 12) .TheFirst(1).With(s => s.Id = 12)
.TheNext(1).With(s => s.OID = 99) .TheNext(1).With(s => s.Id = 99)
.All().With(s => s.SeriesId = 5) .All().With(s => s.SeriesId = 5)
.Build().ToList(); .Build().ToList();

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.OID = 12).Build(); .With(s => s.Id = 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.OID == 79488) .With(s => s.Id == 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.OID == 79488) .With(s => s.Id == 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.OID) .With(f => f.SeriesId = fakeSeries.Id)
.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.OID) .With(f => f.SeriesId = fakeSeries.Id)
.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.OID) .With(f => f.SeriesId = fakeSeries.Id)
.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.OID = 10) .With(s => s.Id = 10)
.TheNext(1) .TheNext(1)
.With(s => s.OID = 11) .With(s => s.Id = 11)
.TheNext(1) .TheNext(1)
.With(s => s.OID = 12) .With(s => s.Id = 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.OID = 10) .With(s => s.Id = 10)
.With(s => s.SeriesType = SeriesType.Daily) .With(s => s.SeriesType = SeriesType.Daily)
.TheNext(1) .TheNext(1)
.With(s => s.OID = 11) .With(s => s.Id = 11)
.TheNext(1) .TheNext(1)
.With(s => s.OID = 12) .With(s => s.Id = 12)
.Build(); .Build();
Db.InsertMany(fakeSeries); Db.InsertMany(fakeSeries);

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.OID) .With(e => e.SeriesId = _series.Id)
.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.OID) .With(e => e.SeriesId = _series.Id)
.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.OID, -1)) .Setup(s => s.GetSceneName(_series.Id, -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.OID, 5)) .Setup(s => s.GetSceneName(_series.Id, 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.OID, -1)) .Setup(s => s.GetSceneName(_series.Id, -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.OID) .With(e => e.SeriesId = _series.Id)
.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.OID) .With(e => e.SeriesId = _series.Id)
.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.OID) .With(e => e.SeriesId = _series.Id)
.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.OID = 79488) .With(s => s.Id = 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.OID = 12345) .With(s => s.Id = 12345)
.With(s => s.Title = "Not 30 Rock") .With(s => s.Title = "Not 30 Rock")
.Build(); .Build();

View File

@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test.ProviderTests
var result = tvDbProvider.SearchSeries(title); var result = tvDbProvider.SearchSeries(title);
result.Should().NotBeEmpty(); result.Should().NotBeEmpty();
result[0].SeriesName.Should().Be(title); result[0].Title.Should().Be(title);
} }

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.OID, 1, 1)) .Setup(s => s.GetEpisode(_series.Id, 1, 1))
.Returns(_episode); .Returns(_episode);
Mocker.GetMock<SceneMappingProvider>() Mocker.GetMock<SceneMappingProvider>()
.Setup(s => s.GetCleanName(_series.OID)) .Setup(s => s.GetCleanName(_series.Id))
.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.OID = 1) .With(s => s.Id = 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.OID); result.Should().OnlyContain(c => c.Series != null && c.SeriesId == series.Id);
} }
[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.OID = 79488) .With(s => s.Id = 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.OID = 79488) .With(s => s.Id = 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.OID = 79488) .With(s => s.Id = 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.OID = 79488) .With(s => s.Id = 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.OID = 79488) .With(s => s.Id = 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.OID = 79488) .With(s => s.Id = 79488)
.With(s => s.Title = "30 Rock") .With(s => s.Title = "30 Rock")
.Build(); .Build();

View File

@ -24,7 +24,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
{ {
Mocker.GetMock<IBasicRepository<RootFolder>>() Mocker.GetMock<IBasicRepository<RootFolder>>()
.Setup(s => s.All()) .Setup(s => s.All())
.Returns(new List<RootFolder> { new RootFolder { OID = 1, Path = @"C:\Test\TV" } }); .Returns(new List<RootFolder> { new RootFolder { Id = 1, Path = @"C:\Test\TV" } });
Mocker.GetMock<DiskProvider>() Mocker.GetMock<DiskProvider>()
.Setup(s => s.GetPathRoot(@"C:\Test\TV")) .Setup(s => s.GetPathRoot(@"C:\Test\TV"))
@ -44,8 +44,8 @@ namespace NzbDrone.Core.Test.RootFolderTests
{ {
Mocker.GetMock<IBasicRepository<RootFolder>>() Mocker.GetMock<IBasicRepository<RootFolder>>()
.Setup(s => s.All()) .Setup(s => s.All())
.Returns(new List<RootFolder> { new RootFolder { OID = 1, Path = @"C:\Test\TV" }, .Returns(new List<RootFolder> { new RootFolder { Id = 1, Path = @"C:\Test\TV" },
new RootFolder { OID = 2, Path = @"C:\Test\TV2" }}); new RootFolder { Id = 2, Path = @"C:\Test\TV2" }});
Mocker.GetMock<DiskProvider>() Mocker.GetMock<DiskProvider>()
.Setup(s => s.GetPathRoot(It.IsAny<String>())) .Setup(s => s.GetPathRoot(It.IsAny<String>()))
@ -65,8 +65,8 @@ namespace NzbDrone.Core.Test.RootFolderTests
{ {
Mocker.GetMock<IBasicRepository<RootFolder>>() Mocker.GetMock<IBasicRepository<RootFolder>>()
.Setup(s => s.All()) .Setup(s => s.All())
.Returns(new List<RootFolder> { new RootFolder { OID = 1, Path = @"C:\Test\TV" }, .Returns(new List<RootFolder> { new RootFolder { Id = 1, Path = @"C:\Test\TV" },
new RootFolder { OID = 2, Path = @"D:\Test\TV" }}); new RootFolder { Id = 2, Path = @"D:\Test\TV" }});
Mocker.GetMock<DiskProvider>() Mocker.GetMock<DiskProvider>()
.Setup(s => s.GetPathRoot(@"C:\Test\TV")) .Setup(s => s.GetPathRoot(@"C:\Test\TV"))
@ -90,7 +90,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
{ {
Mocker.GetMock<IBasicRepository<RootFolder>>() Mocker.GetMock<IBasicRepository<RootFolder>>()
.Setup(s => s.All()) .Setup(s => s.All())
.Returns(new List<RootFolder> { new RootFolder { OID = 1, Path = @"C:\Test\TV" } }); .Returns(new List<RootFolder> { new RootFolder { Id = 1, Path = @"C:\Test\TV" } });
Mocker.GetMock<DiskProvider>() Mocker.GetMock<DiskProvider>()
.Setup(s => s.GetPathRoot(@"C:\Test\TV")) .Setup(s => s.GetPathRoot(@"C:\Test\TV"))

View File

@ -90,7 +90,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
public void invalid_folder_path_throws_on_add(string path) public void invalid_folder_path_throws_on_add(string path)
{ {
Assert.Throws<ArgumentException>(() => Assert.Throws<ArgumentException>(() =>
Mocker.Resolve<RootFolderService>().Add(new RootFolder { OID = 0, Path = path }) Mocker.Resolve<RootFolderService>().Add(new RootFolder { Id = 0, Path = path })
); );
} }

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.OID = 1) .With(s => s.Id = 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.OID, 2, 1); var episode = Mocker.Resolve<EpisodeService>().GetEpisode(fakeSeries.Id, 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.OID = 12) .With(s => s.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = seriesId).Build();
var currentEpisodes = new List<Episode>(); var currentEpisodes = new List<Episode>();
foreach (var tvDbEpisode in tvdbSeries.Episodes) foreach (var tvDbEpisode in tvdbSeries.Episodes)
@ -629,7 +629,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
currentEpisodes.Add(new Episode currentEpisodes.Add(new Episode
{ {
TvDbEpisodeId = tvDbEpisode.Id, TvDbEpisodeId = tvDbEpisode.Id,
OID = 99, Id = 99,
EpisodeFile = new EpisodeFile { EpisodeFileId = 69 }, EpisodeFile = new EpisodeFile { EpisodeFileId = 69 },
Ignored = true, Ignored = true,
Series = fakeSeries, Series = fakeSeries,
@ -657,7 +657,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
//Assert //Assert
updatedEpisodes.Should().HaveSameCount(tvdbSeries.Episodes); updatedEpisodes.Should().HaveSameCount(tvdbSeries.Episodes);
updatedEpisodes.Should().OnlyContain(c => c.OID == 99); updatedEpisodes.Should().OnlyContain(c => c.Id == 99);
updatedEpisodes.Should().OnlyContain(c => c.EpisodeFileId == 69); updatedEpisodes.Should().OnlyContain(c => c.EpisodeFileId == 69);
updatedEpisodes.Should().OnlyContain(c => c.Ignored == true); updatedEpisodes.Should().OnlyContain(c => c.Ignored == true);
} }
@ -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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = seriesId).Build();
var currentEpisodes = new List<Episode>(); var currentEpisodes = new List<Episode>();
foreach (var tvDbEpisode in tvdbSeries.Episodes) foreach (var tvDbEpisode in tvdbSeries.Episodes)
@ -678,7 +678,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
currentEpisodes.Add(new Episode currentEpisodes.Add(new Episode
{ {
TvDbEpisodeId = tvDbEpisode.Id, TvDbEpisodeId = tvDbEpisode.Id,
OID = 99, Id = 99,
EpisodeFile = new EpisodeFile { EpisodeFileId = 69 }, EpisodeFile = new EpisodeFile { EpisodeFileId = 69 },
Ignored = true, Ignored = true,
Series = fakeSeries, Series = fakeSeries,
@ -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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = seriesId).Build();
var currentEpisodes = new List<Episode>(); var currentEpisodes = new List<Episode>();
foreach (var tvDbEpisode in tvdbSeries.Episodes) foreach (var tvDbEpisode in tvdbSeries.Episodes)
@ -724,7 +724,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
currentEpisodes.Add(new Episode currentEpisodes.Add(new Episode
{ {
TvDbEpisodeId = tvDbEpisode.Id, TvDbEpisodeId = tvDbEpisode.Id,
OID = 99, Id = 99,
EpisodeFile = new EpisodeFile { EpisodeFileId = 69 }, EpisodeFile = new EpisodeFile { EpisodeFileId = 69 },
Ignored = true, Ignored = true,
Series = fakeSeries, Series = fakeSeries,
@ -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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = 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.OID = 10) .With(s => s.Id = 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.OID = 10) .With(s => s.Id = 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.OID = 10) .With(s => s.Id = 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.OID = 10) .With(s => s.Id = 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.OID = 10) .With(s => s.Id = 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.OID = 10) .With(s => s.Id = 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.OID = 12345) .With(s => s.Id = 12345)
.With(s => s.CleanTitle = "officeus") .With(s => s.CleanTitle = "officeus")
.Build(); .Build();
@ -1417,7 +1417,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle("officeus")).Returns(fakeSeries); Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle("officeus")).Returns(fakeSeries);
//Act //Act
Mocker.Resolve<EpisodeService>().SetPostDownloadStatus(fakeEpisodes.Select(e => e.OID).ToList(), postDownloadStatus); Mocker.Resolve<EpisodeService>().SetPostDownloadStatus(fakeEpisodes.Select(e => e.Id).ToList(), postDownloadStatus);
//Assert //Assert
var result = Db.Fetch<Episode>(); var result = Db.Fetch<Episode>();
@ -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.OID = 12345) .With(s => s.Id = 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.OID = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.Id = seriesId).Build();
WithRealDb(); WithRealDb();

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.OID) .With(e => e.SeriesId = fakeSeries.Id)
.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.OID) .With(e => e.SeriesId = fakeSeries.Id)
.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.OID) .With(e => e.SeriesId = fakeSeries.Id)
.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.OID) .With(e => e.SeriesId = _series.Id)
.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.OID) .With(e => e.SeriesId = _series.Id)
.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.OID, 1, 1).Should().BeNull(); Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.Id, 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.OID, 1, 1).Should().BeNull(); Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.Id, 1, 1).Should().BeNull();
} }
[Test] [Test]
@ -68,9 +68,9 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
WithSceneNumbering(); WithSceneNumbering();
var result = Mocker.Resolve<EpisodeService>() var result = Mocker.Resolve<EpisodeService>()
.GetEpisodeBySceneNumbering(_series.OID, _episode.SceneSeasonNumber, _episode.SceneEpisodeNumber); .GetEpisodeBySceneNumbering(_series.Id, _episode.SceneSeasonNumber, _episode.SceneEpisodeNumber);
result.OID.Should().Be(_episode.OID); result.Id.Should().Be(_episode.Id);
} }
} }
} }

View File

@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.TvTests
var fakeEpisodes = Builder<Episode>.CreateListOfSize(4) var fakeEpisodes = Builder<Episode>.CreateListOfSize(4)
.All() .All()
.With(c => c.SeriesId = fakeSeason.SeriesId) .With(c => c.SeriesId = fakeSeason.SeriesId)
.With(c => c.SeasonNumber = fakeSeason.OID) .With(c => c.SeasonNumber = fakeSeason.Id)
.With(c => c.Ignored = !ignoreFlag) .With(c => c.Ignored = !ignoreFlag)
.Build().ToList(); .Build().ToList();

View File

@ -40,7 +40,7 @@ namespace NzbDrone.Core.Datastore
public TModel Get(int id) public TModel Get(int id)
{ {
return Queryable.Single(c => c.OID == id); return Queryable.Single(c => c.Id == id);
} }
public TModel Insert(TModel model) public TModel Insert(TModel model)
@ -65,7 +65,7 @@ namespace NzbDrone.Core.Datastore
public TModel Upsert(TModel model) public TModel Upsert(TModel model)
{ {
if (model.OID == 0) if (model.Id == 0)
{ {
return ObjectDatabase.Insert(model); return ObjectDatabase.Insert(model);
} }
@ -88,7 +88,7 @@ namespace NzbDrone.Core.Datastore
public void Purge() public void Purge()
{ {
DeleteMany(Queryable.Select(c => c.OID)); DeleteMany(Queryable.Select(c => c.Id));
} }
} }
} }

View File

@ -4,11 +4,19 @@ using Newtonsoft.Json;
namespace NzbDrone.Core.Datastore namespace NzbDrone.Core.Datastore
{ {
[DebuggerDisplay("ID = {OID}")] [DebuggerDisplay("{GetType()} ID = {Id}")]
public abstract class ModelBase public abstract class ModelBase
{ {
[PetaPoco.Ignore] [PetaPoco.Ignore]
[JsonIgnore]
public int Id
{
get { return OID; }
set { OID = value; }
}
[JsonProperty(PropertyName = "id")] [JsonProperty(PropertyName = "id")]
public int OID { get; set; } private int OID { get; set; }
} }
} }

View File

@ -22,7 +22,7 @@ namespace PetaPoco
episode.EpisodeFile = (episode.EpisodeFileId == 0 ? null : episodeFile); episode.EpisodeFile = (episode.EpisodeFileId == 0 ? null : episodeFile);
// Is this the same season as the current one we're processing // Is this the same season as the current one we're processing
if (_current != null && _current.OID == season.OID) if (_current != null && _current.Id == season.Id)
{ {
// Yes, just add this post to the current author's collection of posts // Yes, just add this post to the current author's collection of posts
_current.Episodes.Add(episode); _current.Episodes.Add(episode);

View File

@ -37,7 +37,7 @@ namespace NzbDrone.Core.Datastore
public T Insert<T>(T obj) where T : ModelBase public T Insert<T>(T obj) where T : ModelBase
{ {
if (obj.OID != 0) if (obj.Id != 0)
{ {
throw new InvalidOperationException("Attempted to insert object with existing ID as new object"); throw new InvalidOperationException("Attempted to insert object with existing ID as new object");
} }
@ -48,7 +48,7 @@ namespace NzbDrone.Core.Datastore
public T Update<T>(T obj) where T : ModelBase public T Update<T>(T obj) where T : ModelBase
{ {
if (obj.OID == 0) if (obj.Id == 0)
{ {
throw new InvalidOperationException("Attempted to update object without an ID"); throw new InvalidOperationException("Attempted to update object without an ID");
} }

View File

@ -57,7 +57,7 @@ namespace NzbDrone.Core.DecisionEngine
//Check if there was only one episode parsed //Check if there was only one episode parsed
//and it is the first or last episode of the season //and it is the first or last episode of the season
if (subject.EpisodeNumbers != null && subject.EpisodeNumbers.Count == 1 && if (subject.EpisodeNumbers != null && subject.EpisodeNumbers.Count == 1 &&
_episodeService.IsFirstOrLastEpisodeOfSeason(series.OID, _episodeService.IsFirstOrLastEpisodeOfSeason(series.Id,
subject.SeasonNumber, subject.EpisodeNumbers[0])) subject.SeasonNumber, subject.EpisodeNumbers[0]))
{ {
maxSize = maxSize * 2; maxSize = maxSize * 2;

View File

@ -27,7 +27,7 @@ namespace NzbDrone.Core.DecisionEngine
{ {
foreach (var episode in subject.Episodes) foreach (var episode in subject.Episodes)
{ {
var bestQualityInHistory = _historyService.GetBestQualityInHistory(subject.Series.OID, episode.SeasonNumber, episode.EpisodeNumber); var bestQualityInHistory = _historyService.GetBestQualityInHistory(subject.Series.Id, 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

@ -20,14 +20,14 @@ namespace NzbDrone.Core.History
public void Trim() public void Trim()
{ {
var oldIds = Queryable.Where(c => c.Date < DateTime.Now.AddDays(-30).Date).Select(c => c.OID); var oldIds = Queryable.Where(c => c.Date < DateTime.Now.AddDays(-30).Date).Select(c => c.Id);
DeleteMany(oldIds); DeleteMany(oldIds);
} }
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.OID == seriesId && c.Episode.SeasonNumber == seasonNumber && var history = Queryable.OrderByDescending(c => c.Quality).FirstOrDefault(c => c.Episode.Series.Id == seriesId && c.Episode.SeasonNumber == seasonNumber &&
c.Episode.EpisodeNumber == episodeNumber); c.Episode.EpisodeNumber == episodeNumber);
if (history != null) if (history != null)

View File

@ -92,7 +92,7 @@ namespace NzbDrone.Core.Indexers
_logger.Debug("Deleting broken Newznab indexer"); _logger.Debug("Deleting broken Newznab indexer");
var brokenIndexers = currentIndexers.Where(i => String.IsNullOrEmpty(i.Name) || String.IsNullOrWhiteSpace(i.Url)).ToList(); var brokenIndexers = currentIndexers.Where(i => String.IsNullOrEmpty(i.Name) || String.IsNullOrWhiteSpace(i.Url)).ToList();
brokenIndexers.ForEach(e => Delete(e.OID)); brokenIndexers.ForEach(e => Delete(e.Id));
currentIndexers = All(); currentIndexers = All();

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Instrumentation
public void Trim() public void Trim()
{ {
var oldIds = Queryable.Where(c => c.Time < DateTime.Now.AddDays(-30).Date).Select(c => c.OID); var oldIds = Queryable.Where(c => c.Time < DateTime.Now.AddDays(-30).Date).Select(c => c.Id);
DeleteMany(oldIds); DeleteMany(oldIds);
} }
} }

View File

@ -81,7 +81,7 @@ namespace NzbDrone.Core.Jobs
//Process the list of remaining episodes, 1 by 1 //Process the list of remaining episodes, 1 by 1
foreach (var episode in individualEpisodes) foreach (var episode in individualEpisodes)
{ {
_episodeSearchJob.Start(notification, new { EpisodeId = episode.OID}); _episodeSearchJob.Start(notification, new { EpisodeId = episode.Id});
} }
} }

View File

@ -66,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.OID)).ToList(); var syncList = _seriesRepository.All().Where(s => s.LastInfoSync == null && !_attemptedSeries.Contains(s.Id)).ToList();
if (syncList.Count == 0) if (syncList.Count == 0)
{ {
return; return;
@ -76,20 +76,20 @@ namespace NzbDrone.Core.Jobs
{ {
try try
{ {
_attemptedSeries.Add(((ModelBase)currentSeries).OID); _attemptedSeries.Add(((ModelBase)currentSeries).Id);
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 = ((ModelBase)currentSeries).OID }); _updateInfoJob.Start(notification, new { SeriesId = ((ModelBase)currentSeries).Id });
_diskScanJob.Start(notification, new { SeriesId = ((ModelBase)currentSeries).OID }); _diskScanJob.Start(notification, new { SeriesId = ((ModelBase)currentSeries).Id });
var updatedSeries = _seriesRepository.Get(((ModelBase)currentSeries).OID); var updatedSeries = _seriesRepository.Get(((ModelBase)currentSeries).Id);
AutoIgnoreSeasons(((ModelBase)updatedSeries).OID); AutoIgnoreSeasons(((ModelBase)updatedSeries).Id);
//Download the banner for the new series //Download the banner for the new series
_bannerDownloadJob.Start(notification, new { SeriesId = ((ModelBase)updatedSeries).OID }); _bannerDownloadJob.Start(notification, new { SeriesId = ((ModelBase)updatedSeries).Id });
//Get Scene Numbering if applicable //Get Scene Numbering if applicable
_xemUpdateJob.Start(notification, new { SeriesId = ((ModelBase)updatedSeries).OID }); _xemUpdateJob.Start(notification, new { SeriesId = ((ModelBase)updatedSeries).Id });
notification.CurrentMessage = String.Format("{0} was successfully imported", updatedSeries.Title); notification.CurrentMessage = String.Format("{0} was successfully imported", updatedSeries.Title);
} }

View File

@ -46,7 +46,7 @@ namespace NzbDrone.Core.Jobs
if (_jobs.All(c => c.GetType().ToString() != currentJob.TypeName)) if (_jobs.All(c => c.GetType().ToString() != currentJob.TypeName))
{ {
_logger.Debug("Removing job from database '{0}'", currentJob.Name); _logger.Debug("Removing job from database '{0}'", currentJob.Name);
Delete(currentJob.OID); Delete(currentJob.Id);
} }
} }

View File

@ -45,7 +45,7 @@ namespace NzbDrone.Core.Jobs
Logger.Debug("Processing missing episodes from the past week, count: {0}", missingEpisodes.Count); Logger.Debug("Processing missing episodes from the past week, count: {0}", missingEpisodes.Count);
foreach (var episode in missingEpisodes) foreach (var episode in missingEpisodes)
{ {
_episodeSearchJob.Start(notification, new { EpisodeId = episode.OID }); _episodeSearchJob.Start(notification, new { EpisodeId = episode.Id });
} }
} }

View File

@ -45,7 +45,7 @@ namespace NzbDrone.Core.Jobs
Logger.Debug("Processing missing episodes from the last 30 days, count: {0}", missingEpisodes.Count); Logger.Debug("Processing missing episodes from the last 30 days, count: {0}", missingEpisodes.Count);
foreach (var episode in missingEpisodes) foreach (var episode in missingEpisodes)
{ {
_episodeSearchJob.Start(notification, new { EpisodeId = episode.OID }); _episodeSearchJob.Start(notification, new { EpisodeId = episode.Id });
} }
} }

View File

@ -58,12 +58,12 @@ namespace NzbDrone.Core.Jobs
{ {
notification.CurrentMessage = String.Format("Refreshing episode metadata for '{0}'", series.Title); notification.CurrentMessage = String.Format("Refreshing episode metadata for '{0}'", series.Title);
Logger.Debug("Getting episodes from database for series: {0}", series.OID); Logger.Debug("Getting episodes from database for series: {0}", series.Id);
var episodeFiles = _mediaFileProvider.GetSeriesFiles(series.OID); var episodeFiles = _mediaFileProvider.GetSeriesFiles(series.Id);
if (episodeFiles == null || episodeFiles.Count == 0) if (episodeFiles == null || episodeFiles.Count == 0)
{ {
Logger.Warn("No episodes in database found for series: {0}", series.OID); Logger.Warn("No episodes in database found for series: {0}", series.Id);
return; return;
} }

View File

@ -58,12 +58,12 @@ namespace NzbDrone.Core.Jobs
{ {
notification.CurrentMessage = String.Format("Renaming episodes for '{0}'", series.Title); notification.CurrentMessage = String.Format("Renaming episodes for '{0}'", series.Title);
Logger.Debug("Getting episodes from database for series: {0}", series.OID); Logger.Debug("Getting episodes from database for series: {0}", series.Id);
var episodeFiles = _mediaFileProvider.GetSeriesFiles(series.OID); var episodeFiles = _mediaFileProvider.GetSeriesFiles(series.Id);
if (episodeFiles == null || episodeFiles.Count == 0) if (episodeFiles == null || episodeFiles.Count == 0)
{ {
Logger.Warn("No episodes in database found for series: {0}", series.OID); Logger.Warn("No episodes in database found for series: {0}", series.Id);
return; return;
} }

View File

@ -68,11 +68,11 @@ namespace NzbDrone.Core.Jobs
if (episodes.Count == successes.Count) if (episodes.Count == successes.Count)
return; return;
var missingEpisodes = episodes.Select(e => e.OID).Except(successes).ToList(); var missingEpisodes = episodes.Select(e => e.Id).Except(successes).ToList();
foreach (var episode in episodes.Where(e => !e.Ignored && missingEpisodes.Contains(e.OID)).OrderBy(o => o.EpisodeNumber)) foreach (var episode in episodes.Where(e => !e.Ignored && missingEpisodes.Contains(e.Id)).OrderBy(o => o.EpisodeNumber))
{ {
_episodeSearchJob.Start(notification, new { EpisodeId = episode.OID }); _episodeSearchJob.Start(notification, new { EpisodeId = episode.Id });
} }
} }
} }

View File

@ -74,7 +74,7 @@ namespace NzbDrone.Core.Jobs
try try
{ {
notification.CurrentMessage = "Updating " + series.Title; notification.CurrentMessage = "Updating " + series.Title;
_seriesService.UpdateSeriesInfo(series.OID); _seriesService.UpdateSeriesInfo(series.Id);
_episodeService.RefreshEpisodeInfo(series); _episodeService.RefreshEpisodeInfo(series);
notification.CurrentMessage = "Update completed for " + series.Title; notification.CurrentMessage = "Update completed for " + series.Title;
} }

View File

@ -41,7 +41,7 @@ namespace NzbDrone.Core.Providers
logger.Trace("Ensuring Banner Folder exists: ", bannerPath); logger.Trace("Ensuring Banner Folder exists: ", bannerPath);
_diskProvider.CreateDirectory(bannerPath); _diskProvider.CreateDirectory(bannerPath);
var bannerFilename = Path.Combine(bannerPath, series.OID.ToString()) + ".jpg"; var bannerFilename = Path.Combine(bannerPath, series.Id.ToString()) + ".jpg";
logger.Trace("Downloading banner for '{0}'", series.Title); logger.Trace("Downloading banner for '{0}'", series.Title);

View File

@ -70,13 +70,13 @@ namespace NzbDrone.Core.Providers
return new List<EpisodeFile>(); return new List<EpisodeFile>();
} }
if (_episodeService.GetEpisodeBySeries(series.OID).Count == 0) if (_episodeService.GetEpisodeBySeries(series.Id).Count == 0)
{ {
Logger.Debug("Series {0} has no episodes. skipping", series.Title); Logger.Debug("Series {0} has no episodes. skipping", series.Title);
return new List<EpisodeFile>(); return new List<EpisodeFile>();
} }
var seriesFile = _mediaFileProvider.GetSeriesFiles(series.OID); var seriesFile = _mediaFileProvider.GetSeriesFiles(series.Id);
CleanUp(seriesFile); CleanUp(seriesFile);
var mediaFileList = GetVideoFiles(path); var mediaFileList = GetVideoFiles(path);
@ -158,7 +158,7 @@ namespace NzbDrone.Core.Providers
var episodeFile = new EpisodeFile(); var episodeFile = new EpisodeFile();
episodeFile.DateAdded = DateTime.Now; episodeFile.DateAdded = DateTime.Now;
episodeFile.SeriesId = series.OID; episodeFile.SeriesId = series.Id;
episodeFile.Path = filePath.NormalizePath(); episodeFile.Path = filePath.NormalizePath();
episodeFile.Size = size; episodeFile.Size = size;
episodeFile.Quality = parseResult.Quality.Quality; episodeFile.Quality = parseResult.Quality.Quality;
@ -236,7 +236,7 @@ namespace NzbDrone.Core.Providers
_eventAggregator.Publish(new EpisodeDownloadedEvent(parseResult)); _eventAggregator.Publish(new EpisodeDownloadedEvent(parseResult));
foreach (var episode in episodes) foreach (var episode in episodes)
_signalRProvider.UpdateEpisodeStatus(episode.OID, EpisodeStatusType.Ready, parseResult.Quality); _signalRProvider.UpdateEpisodeStatus(episode.Id, EpisodeStatusType.Ready, parseResult.Quality);
} }
return episodeFile; return episodeFile;
@ -259,7 +259,7 @@ namespace NzbDrone.Core.Providers
//Set the EpisodeFileId for each episode attached to this file to 0 //Set the EpisodeFileId for each episode attached to this file to 0
foreach (var episode in _episodeService.GetEpisodesByFileId(episodeFile.EpisodeFileId)) foreach (var episode in _episodeService.GetEpisodesByFileId(episodeFile.EpisodeFileId))
{ {
Logger.Trace("Detaching episode {0} from file.", episode.OID); Logger.Trace("Detaching episode {0} from file.", episode.Id);
episode.EpisodeFile = null; episode.EpisodeFile = null;
episode.Ignored = _configService.AutoIgnorePreviouslyDownloadedEpisodes; episode.Ignored = _configService.AutoIgnorePreviouslyDownloadedEpisodes;
episode.GrabDate = null; episode.GrabDate = null;

View File

@ -32,7 +32,7 @@ namespace NzbDrone.Core.Providers.Metadata
public override void CreateForSeries(Series series, TvdbSeries tvDbSeries) public override void CreateForSeries(Series series, TvdbSeries tvDbSeries)
{ {
//Create tvshow.nfo, fanart.jpg, folder.jpg and season##.tbn //Create tvshow.nfo, fanart.jpg, folder.jpg and season##.tbn
var episodeGuideUrl = GetEpisodeGuideUrl(series.OID); var episodeGuideUrl = GetEpisodeGuideUrl(series.Id);
_logger.Debug("Generating tvshow.nfo for: {0}", series.Title); _logger.Debug("Generating tvshow.nfo for: {0}", series.Title);
var sb = new StringBuilder(); var sb = new StringBuilder();

View File

@ -91,7 +91,7 @@ namespace NzbDrone.Core.Providers
public virtual void CreateForSeries(Series series) public virtual void CreateForSeries(Series series)
{ {
var tvDbSeries = _tvDbProvider.GetSeries(series.OID, false, true); var tvDbSeries = _tvDbProvider.GetSeries(series.TvDbId, false, true);
CreateForSeries(series, tvDbSeries); CreateForSeries(series, tvDbSeries);
} }

View File

@ -57,7 +57,7 @@ namespace NzbDrone.Core.Providers.Search
var searchResult = new SearchHistory var searchResult = new SearchHistory
{ {
SearchTime = DateTime.Now, SearchTime = DateTime.Now,
SeriesId = series.OID, SeriesId = series.Id,
EpisodeId = options.GetType().GetProperty("Episode") != null ? options.Episode.EpisodeId : null, EpisodeId = options.GetType().GetProperty("Episode") != null ? options.Episode.EpisodeId : null,
SeasonNumber = options.GetType().GetProperty("SeasonNumber") != null ? options.SeasonNumber : null SeasonNumber = options.GetType().GetProperty("SeasonNumber") != null ? options.SeasonNumber : null
}; };
@ -106,7 +106,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 || ((ModelBase)episodeParseResult.Series).OID != series.OID) if(episodeParseResult.Series == null || ((ModelBase)episodeParseResult.Series).Id != series.Id)
{ {
item.SearchError = ReportRejectionType.WrongSeries; item.SearchError = ReportRejectionType.WrongSeries;
continue; continue;
@ -114,7 +114,7 @@ namespace NzbDrone.Core.Providers.Search
episodeParseResult.Episodes = _episodeService.GetEpisodesByParseResult(episodeParseResult); episodeParseResult.Episodes = _episodeService.GetEpisodesByParseResult(episodeParseResult);
if (searchResult.Successes.Intersect(episodeParseResult.Episodes.Select(e => e.OID)).Any()) if (searchResult.Successes.Intersect(episodeParseResult.Episodes.Select(e => e.Id)).Any())
{ {
item.SearchError = ReportRejectionType.Skipped; item.SearchError = ReportRejectionType.Skipped;
continue; continue;
@ -129,7 +129,7 @@ namespace NzbDrone.Core.Providers.Search
if(item.SearchError == ReportRejectionType.None) if(item.SearchError == ReportRejectionType.None)
{ {
if(DownloadReport(notification, episodeParseResult, item)) if(DownloadReport(notification, episodeParseResult, item))
searchResult.Successes.AddRange(episodeParseResult.Episodes.Select(e => e.OID)); searchResult.Successes.AddRange(episodeParseResult.Episodes.Select(e => e.Id));
} }
} }
catch(Exception e) catch(Exception e)
@ -168,12 +168,12 @@ namespace NzbDrone.Core.Providers.Search
public virtual string GetSearchTitle(Series series, int seasonNumber = -1) public virtual string GetSearchTitle(Series series, int seasonNumber = -1)
{ {
var seasonTitle = _sceneMappingProvider.GetSceneName(series.OID, seasonNumber); var seasonTitle = _sceneMappingProvider.GetSceneName(series.Id, seasonNumber);
if(!String.IsNullOrWhiteSpace(seasonTitle)) if(!String.IsNullOrWhiteSpace(seasonTitle))
return seasonTitle; return seasonTitle;
var title = _sceneMappingProvider.GetSceneName(series.OID); var title = _sceneMappingProvider.GetSceneName(series.Id);
if (String.IsNullOrWhiteSpace(title)) if (String.IsNullOrWhiteSpace(title))
{ {

View File

@ -42,7 +42,7 @@ namespace NzbDrone.Core.Providers
{ {
foreach (var episode in message.ParseResult.Episodes) foreach (var episode in message.ParseResult.Episodes)
{ {
UpdateEpisodeStatus(episode.OID, EpisodeStatusType.Downloading, message.ParseResult.Quality); UpdateEpisodeStatus(episode.Id, EpisodeStatusType.Downloading, message.ParseResult.Quality);
} }
} }
} }

View File

@ -4,7 +4,6 @@ using System.Linq;
using NLog; using NLog;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Tvdb;
using TvdbLib; using TvdbLib;
using TvdbLib.Cache; using TvdbLib.Cache;
using TvdbLib.Data; using TvdbLib.Data;
@ -36,7 +35,7 @@ namespace NzbDrone.Core.Providers
} }
public virtual List<TvdbSeriesSearchItem> SearchSeries(string title) public virtual List<Series> SearchSeries(string title)
{ {
logger.Debug("Searching TVDB for '{0}'", title); logger.Debug("Searching TVDB for '{0}'", title);
@ -45,18 +44,24 @@ namespace NzbDrone.Core.Providers
title = title.Replace(" & ", " "); title = title.Replace(" & ", " ");
} }
var result = _handlerV2.SearchSeries(title); var searchResult = _handlerV2.SearchSeries(title).Select(tvdbSeriesSearchItem => new Series
{
TvDbId = tvdbSeriesSearchItem.seriesid,
Title = tvdbSeriesSearchItem.SeriesName,
FirstAired = tvdbSeriesSearchItem.FirstAired,
Overview = tvdbSeriesSearchItem.Overview
}).ToList();
logger.Debug("Search for '{0}' returned {1} possible results", title, result.Count); logger.Debug("Search for '{0}' returned {1} possible results", title, searchResult.Count);
return result; return searchResult;
} }
public virtual TvdbSeries GetSeries(int id, bool loadEpisodes, bool loadActors = false) public virtual TvdbSeries GetSeries(int tvDbSeriesId, bool loadEpisodes, bool loadActors = false)
{ {
lock (_handler) lock (_handler)
{ {
logger.Debug("Fetching SeriesId'{0}' from tvdb", id); logger.Debug("Fetching SeriesId'{0}' from tvdb", tvDbSeriesId);
var result = _handler.GetSeries(id, TvdbLanguage.DefaultLanguage, loadEpisodes, loadActors, true, true); var result = _handler.GetSeries(tvDbSeriesId, TvdbLanguage.DefaultLanguage, loadEpisodes, loadActors, true, true);
//Remove duplicated episodes //Remove duplicated episodes
var episodes = result.Episodes.OrderByDescending(e => e.FirstAired).ThenByDescending(e => e.EpisodeName) var episodes = result.Episodes.OrderByDescending(e => e.FirstAired).ThenByDescending(e => e.EpisodeName)

View File

@ -32,9 +32,9 @@ namespace NzbDrone.Core.Providers
public Series FindMatchingTvRageSeries(Series series) public Series FindMatchingTvRageSeries(Series series)
{ {
var firstEpisode = _episodeService.GetEpisode(series.OID, 1, 1); var firstEpisode = _episodeService.GetEpisode(series.Id, 1, 1);
var cleanName = _sceneMappingProvider.GetCleanName(series.OID); var cleanName = _sceneMappingProvider.GetCleanName(series.Id);
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.OID || s.Label == series.Title); path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.Id || 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.OID || s.Label == series.Title); path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.Id || 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.OID, username, password); var xbmcSeriesPath = GetXbmcSeriesPath(host, series.Id, 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

@ -38,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.OID)).ToList(); var wantedSeries = series.Where(s => ids.Contains(s.Id)).ToList();
foreach(var ser in wantedSeries) foreach(var ser in wantedSeries)
{ {
@ -82,7 +82,7 @@ namespace NzbDrone.Core.Providers
try try
{ {
var episodesToUpdate = new List<Episode>(); var episodesToUpdate = new List<Episode>();
var mappings = _xemCommunicationProvider.GetSceneTvdbMappings(series.OID); var mappings = _xemCommunicationProvider.GetSceneTvdbMappings(series.Id);
if (mappings == null) if (mappings == null)
{ {
@ -90,7 +90,7 @@ namespace NzbDrone.Core.Providers
return; return;
} }
var episodes = _episodeService.GetEpisodeBySeries(series.OID); var episodes = _episodeService.GetEpisodeBySeries(series.Id);
foreach (var mapping in mappings) foreach (var mapping in mappings)
{ {

View File

@ -94,7 +94,7 @@ namespace NzbDrone.Core.Tv
return new List<Episode>(); return new List<Episode>();
} }
var episodeInfo = GetEpisode(((ModelBase)parseResult.Series).OID, parseResult.AirDate.Value); var episodeInfo = GetEpisode(((ModelBase)parseResult.Series).Id, parseResult.AirDate.Value);
if (episodeInfo != null) if (episodeInfo != null)
{ {
@ -116,14 +116,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(((ModelBase)parseResult.Series).OID, parseResult.SeasonNumber, episodeNumber); episodeInfo = GetEpisodeBySceneNumbering(((ModelBase)parseResult.Series).Id, parseResult.SeasonNumber, episodeNumber);
if (episodeInfo == null) if (episodeInfo == null)
{ {
episodeInfo = GetEpisode(((ModelBase)parseResult.Series).OID, parseResult.SeasonNumber, episodeNumber); episodeInfo = GetEpisode(((ModelBase)parseResult.Series).Id, parseResult.SeasonNumber, episodeNumber);
if (episodeInfo == null && parseResult.AirDate != null) if (episodeInfo == null && parseResult.AirDate != null)
{ {
episodeInfo = GetEpisode(((ModelBase)parseResult.Series).OID, parseResult.AirDate.Value); episodeInfo = GetEpisode(((ModelBase)parseResult.Series).Id, parseResult.AirDate.Value);
} }
} }
@ -176,14 +176,14 @@ namespace NzbDrone.Core.Tv
public virtual void RefreshEpisodeInfo(Series series) public virtual void RefreshEpisodeInfo(Series series)
{ {
logger.Trace("Starting episode info refresh for series: {0}", series.Title.WithDefault(series.OID)); logger.Trace("Starting episode info refresh for series: {0}", series.Title.WithDefault(series.Id));
var successCount = 0; var successCount = 0;
var failCount = 0; var failCount = 0;
var tvdbEpisodes = _tvDbProvider.GetEpisodes(series.OID); var tvdbEpisodes = _tvDbProvider.GetEpisodes(series.TvDbId);
var seriesEpisodes = GetEpisodeBySeries(series.OID); var seriesEpisodes = GetEpisodeBySeries(series.Id);
var updateList = new List<Episode>(); var updateList = new List<Episode>();
var newList = new List<Episode>(); var newList = new List<Episode>();
@ -214,7 +214,7 @@ namespace NzbDrone.Core.Tv
} }
else else
{ {
episodeToUpdate.Ignored = _seasonRepository.IsIgnored(series.OID, episode.SeasonNumber); episodeToUpdate.Ignored = _seasonRepository.IsIgnored(series.Id, episode.SeasonNumber);
} }
} }
else else
@ -230,7 +230,7 @@ namespace NzbDrone.Core.Tv
episodeToUpdate.EpisodeFile = null; episodeToUpdate.EpisodeFile = null;
} }
episodeToUpdate.SeriesId = series.OID; episodeToUpdate.SeriesId = series.Id;
episodeToUpdate.Series = series; episodeToUpdate.Series = series;
episodeToUpdate.TvDbEpisodeId = episode.TvDbEpisodeId; episodeToUpdate.TvDbEpisodeId = episode.TvDbEpisodeId;
episodeToUpdate.EpisodeNumber = episode.EpisodeNumber; episodeToUpdate.EpisodeNumber = episode.EpisodeNumber;
@ -273,7 +273,7 @@ namespace NzbDrone.Core.Tv
public virtual IList<int> GetEpisodeNumbersBySeason(int seriesId, int seasonNumber) public virtual IList<int> GetEpisodeNumbersBySeason(int seriesId, int seasonNumber)
{ {
return GetEpisodesBySeason(seriesId, seasonNumber).Select(c => c.OID).ToList(); return GetEpisodesBySeason(seriesId, seasonNumber).Select(c => c.Id).ToList();
} }
public virtual void SetEpisodeIgnore(int episodeId, bool isIgnored) public virtual void SetEpisodeIgnore(int episodeId, bool isIgnored)
@ -302,13 +302,13 @@ namespace NzbDrone.Core.Tv
private void DeleteEpisodesNotInTvdb(Series series, IEnumerable<Episode> tvdbEpisodes) private void DeleteEpisodesNotInTvdb(Series series, IEnumerable<Episode> tvdbEpisodes)
{ {
logger.Trace("Starting deletion of episodes that no longer exist in TVDB: {0}", series.Title.WithDefault(series.OID)); logger.Trace("Starting deletion of episodes that no longer exist in TVDB: {0}", series.Title.WithDefault(series.Id));
foreach (var episode in tvdbEpisodes) foreach (var episode in tvdbEpisodes)
{ {
_episodeRepository.Delete(episode.OID); _episodeRepository.Delete(episode.Id);
} }
logger.Trace("Deleted episodes that no longer exist in TVDB for {0}", series.OID); logger.Trace("Deleted episodes that no longer exist in TVDB for {0}", series.Id);
} }
public virtual void SetPostDownloadStatus(List<int> episodeIds, PostDownloadStatusType postDownloadStatus) public virtual void SetPostDownloadStatus(List<int> episodeIds, PostDownloadStatusType postDownloadStatus)
@ -349,7 +349,7 @@ namespace NzbDrone.Core.Tv
{ {
foreach (var episode in message.ParseResult.Episodes) foreach (var episode in message.ParseResult.Episodes)
{ {
logger.Trace("Marking episode {0} as fetched.", episode.OID); logger.Trace("Marking episode {0} as fetched.", episode.Id);
episode.GrabDate = DateTime.UtcNow; episode.GrabDate = DateTime.UtcNow;
_episodeRepository.Update(episode); _episodeRepository.Update(episode);
} }

View File

@ -33,7 +33,7 @@ namespace NzbDrone.Core.Tv
public bool IsIgnored(int seriesId, int seasonNumber) public bool IsIgnored(int seriesId, int seasonNumber)
{ {
var season = Queryable.SingleOrDefault(c => c.OID == seriesId && c.SeasonNumber == seasonNumber); var season = Queryable.SingleOrDefault(c => c.Id == seriesId && c.SeasonNumber == seasonNumber);
if(season == null) return false; if(season == null) return false;

View File

@ -59,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.OID, false, true); var tvDbSeries = _tvDbProvider.GetSeries(series.TvDbId, false, true);
series.Title = tvDbSeries.SeriesName; series.Title = tvDbSeries.SeriesName;
series.AirTime = CleanAirsTime(tvDbSeries.AirsTime); series.AirTime = CleanAirsTime(tvDbSeries.AirsTime);
@ -146,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 => ((ModelBase)s).OID == series.OID); var edited = editedSeries.Single(s => ((ModelBase)s).Id == series.Id);
series.QualityProfileId = edited.QualityProfileId; series.QualityProfileId = edited.QualityProfileId;
series.Monitored = edited.Monitored; series.Monitored = edited.Monitored;
series.SeasonFolder = edited.SeasonFolder; series.SeasonFolder = edited.SeasonFolder;