1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-18 21:35:51 -04:00

fixed more tests.

This commit is contained in:
kay.one
2013-02-24 11:57:33 -08:00
parent a98d792c0d
commit 9931bab998
51 changed files with 184 additions and 169 deletions
@@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.ProviderTests
WithTempAsAppPath();
_series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12345)
.With(s => s.OID = 12345)
.Build();
var path = @"C:\Windows\Temp";
@@ -81,7 +81,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Build();
var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = seriesId)
.With(s => s.OID = seriesId)
.With(s => s.Title = "The Office")
.Build();
@@ -28,13 +28,13 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
public void should_not_move_file_if_source_and_destination_are_the_same_path()
{
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 5)
.With(s => s.OID = 5)
.With(s => s.Title = "30 Rock")
.Build();
var fakeEpisode = Builder<Episode>.CreateListOfSize(1)
.All()
.With(e => e.SeriesId = fakeSeries.SeriesId)
.With(e => e.SeriesId = fakeSeries.OID)
.With(e => e.SeasonNumber = 1)
.With(e => e.EpisodeNumber = 1)
.Build();
@@ -43,12 +43,12 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fi = new FileInfo(Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", filename + ".avi"));
var file = Builder<EpisodeFile>.CreateNew()
.With(f => f.SeriesId = fakeSeries.SeriesId)
.With(f => f.SeriesId = fakeSeries.OID)
.With(f => f.Path = fi.FullName)
.Build();
Mocker.GetMock<ISeriesRepository>()
.Setup(e => e.Get(fakeSeries.SeriesId))
.Setup(e => e.Get(fakeSeries.OID))
.Returns(fakeSeries);
Mocker.GetMock<IEpisodeService>()
@@ -74,13 +74,13 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
public void should_use_EpisodeFiles_quality()
{
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 5)
.With(s => s.OID = 5)
.With(s => s.Title = "30 Rock")
.Build();
var fakeEpisode = Builder<Episode>.CreateListOfSize(1)
.All()
.With(e => e.SeriesId = fakeSeries.SeriesId)
.With(e => e.SeriesId = fakeSeries.OID)
.With(e => e.SeasonNumber = 1)
.With(e => e.EpisodeNumber = 1)
.Build();
@@ -91,14 +91,14 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
const string message = "30 Rock - 1x01 - [WEBDL]";
var file = Builder<EpisodeFile>.CreateNew()
.With(f => f.SeriesId = fakeSeries.SeriesId)
.With(f => f.SeriesId = fakeSeries.OID)
.With(f => f.Path = currentFilename)
.With(f => f.Quality = QualityTypes.WEBDL720p)
.With(f => f.Proper = false)
.Build();
Mocker.GetMock<ISeriesRepository>()
.Setup(e => e.Get(fakeSeries.SeriesId))
.Setup(e => e.Get(fakeSeries.OID))
.Returns(fakeSeries);
Mocker.GetMock<IEpisodeService>()
@@ -133,13 +133,13 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
public void should_log_error_and_return_null_when_source_file_does_not_exists()
{
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 5)
.With(s => s.OID = 5)
.With(s => s.Title = "30 Rock")
.Build();
var fakeEpisode = Builder<Episode>.CreateListOfSize(1)
.All()
.With(e => e.SeriesId = fakeSeries.SeriesId)
.With(e => e.SeriesId = fakeSeries.OID)
.With(e => e.SeasonNumber = 1)
.With(e => e.EpisodeNumber = 1)
.Build();
@@ -150,14 +150,14 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
const string message = "30 Rock - 1x01 - [WEBDL]";
var file = Builder<EpisodeFile>.CreateNew()
.With(f => f.SeriesId = fakeSeries.SeriesId)
.With(f => f.SeriesId = fakeSeries.OID)
.With(f => f.Path = currentFilename)
.With(f => f.Quality = QualityTypes.WEBDL720p)
.With(f => f.Proper = false)
.Build();
Mocker.GetMock<ISeriesRepository>()
.Setup(e => e.Get(fakeSeries.SeriesId))
.Setup(e => e.Get(fakeSeries.OID))
.Returns(fakeSeries);
Mocker.GetMock<IEpisodeService>()
@@ -97,7 +97,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.Returns(true);
var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12).Build();
.With(s => s.OID = 12).Build();
//Act
Mocker.Resolve<DiskScanProvider>().Scan(series);
@@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
series = Builder<Series>
.CreateNew()
.With(s => s.SeriesId == 79488)
.With(s => s.OID == 79488)
.With(s => s.Title == "30 Rock")
.Build();
@@ -37,7 +37,7 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
series = Builder<Series>
.CreateNew()
.With(s => s.SeriesId == 79488)
.With(s => s.OID == 79488)
.With(s => s.Title == "30 Rock")
.Build();
@@ -72,7 +72,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
{
var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
.All()
.With(f => f.SeriesId = fakeSeries.SeriesId)
.With(f => f.SeriesId = fakeSeries.OID)
.Build().ToList();
Mocker.GetMock<DiskScanProvider>().Setup(s => s.Scan(fakeSeries, droppedFolder)).Returns(fakeEpisodeFiles);
@@ -224,7 +224,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
.All()
.With(f => f.SeriesId = fakeSeries.SeriesId)
.With(f => f.SeriesId = fakeSeries.OID)
.Build().ToList();
//Act
@@ -71,7 +71,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
private void WithImportedFile(string file)
{
var fakeEpisodeFile = Builder<EpisodeFile>.CreateNew()
.With(f => f.SeriesId = fakeSeries.SeriesId)
.With(f => f.SeriesId = fakeSeries.OID)
.Build();
Mocker.GetMock<DiskScanProvider>().Setup(s => s.ImportFile(fakeSeries, file)).Returns(fakeEpisodeFile);
@@ -138,11 +138,11 @@ namespace NzbDrone.Core.Test.ProviderTests
.All()
.With(s => s.SeriesType = SeriesType.Standard)
.TheFirst(1)
.With(s => s.SeriesId = 10)
.With(s => s.OID = 10)
.TheNext(1)
.With(s => s.SeriesId = 11)
.With(s => s.OID = 11)
.TheNext(1)
.With(s => s.SeriesId = 12)
.With(s => s.OID = 12)
.Build();
Db.InsertMany(fakeSeries);
@@ -170,12 +170,12 @@ namespace NzbDrone.Core.Test.ProviderTests
.All()
.With(s => s.SeriesType = SeriesType.Standard)
.TheFirst(1)
.With(s => s.SeriesId = 10)
.With(s => s.OID = 10)
.With(s => s.SeriesType = SeriesType.Daily)
.TheNext(1)
.With(s => s.SeriesId = 11)
.With(s => s.OID = 11)
.TheNext(1)
.With(s => s.SeriesId = 12)
.With(s => s.OID = 12)
.Build();
Db.InsertMany(fakeSeries);
@@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.ProviderTests
_searchHistory = Builder<SearchHistory>.CreateNew()
.With(h => h.EpisodeId = _episode.OID)
.With(h => h.SeriesId - _series.SeriesId)
.With(h => h.SeriesId - _series.OID)
.With(h => h.SearchHistoryItems = items)
.Build();
}
@@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.DailyEpisodeSearchTests
_episode = Builder<Episode>
.CreateNew()
.With(e => e.SeriesId = _series.SeriesId)
.With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series)
.Build();
@@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.EpisodeSearchTests
_episode = Builder<Episode>
.CreateNew()
.With(e => e.SeriesId = _series.SeriesId)
.With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series)
.Build();
@@ -29,7 +29,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
private void WithSceneMapping()
{
Mocker.GetMock<SceneMappingProvider>()
.Setup(s => s.GetSceneName(_series.SeriesId, -1))
.Setup(s => s.GetSceneName(_series.OID, -1))
.Returns("Hawaii Five 0 2010");
}
@@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
public void should_return_season_scene_name_when_one_exists()
{
Mocker.GetMock<SceneMappingProvider>()
.Setup(s => s.GetSceneName(_series.SeriesId, 5))
.Setup(s => s.GetSceneName(_series.OID, 5))
.Returns("Hawaii Five 0 2010 - Season 5");
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)
@@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
_series.Title = input;
Mocker.GetMock<SceneMappingProvider>()
.Setup(s => s.GetSceneName(_series.SeriesId, -1))
.Setup(s => s.GetSceneName(_series.OID, -1))
.Returns("");
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)
@@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.PartialSeasonSearchTests
_episodes = Builder<Episode>
.CreateListOfSize(10)
.All()
.With(e => e.SeriesId = _series.SeriesId)
.With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series)
.Build()
.ToList();
@@ -36,14 +36,14 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
_episode = Builder<Episode>
.CreateNew()
.With(e => e.SeriesId = _series.SeriesId)
.With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series)
.Build();
_episodes = Builder<Episode>
.CreateListOfSize(10)
.All()
.With(e => e.SeriesId = _series.SeriesId)
.With(e => e.SeriesId = _series.OID)
.With(e => e.Series = _series)
.Build()
.ToList();
@@ -36,12 +36,12 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
public void Setup()
{
_matchingSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();
_mismatchedSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 12345)
.With(s => s.OID = 12345)
.With(s => s.Title = "Not 30 Rock")
.Build();
@@ -46,11 +46,11 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageMappingProviderTests
.Build();
Mocker.GetMock<IEpisodeService>()
.Setup(s => s.GetEpisode(_series.SeriesId, 1, 1))
.Setup(s => s.GetEpisode(_series.OID, 1, 1))
.Returns(_episode);
Mocker.GetMock<SceneMappingProvider>()
.Setup(s => s.GetCleanName(_series.SeriesId))
.Setup(s => s.GetCleanName(_series.OID))
.Returns("");
Mocker.GetMock<TvRageProvider>()
@@ -43,7 +43,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.Build();
series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 1)
.With(s => s.OID = 1)
.And(c => c.Monitored = true)
.Build();
@@ -71,7 +71,7 @@ namespace NzbDrone.Core.Test.ProviderTests
//Assert
result.Should().HaveCount(5);
result.Should().OnlyContain(c => c.Series != null && c.SeriesId == series.SeriesId);
result.Should().OnlyContain(c => c.Series != null && c.SeriesId == series.OID);
}
[Test]
@@ -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 fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();
@@ -491,7 +491,7 @@ namespace NzbDrone.Core.Test.ProviderTests
var url = "http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video))";
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();
@@ -519,7 +519,7 @@ 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 fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();
@@ -552,7 +552,7 @@ 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 fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();
@@ -585,7 +585,7 @@ 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 fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();
@@ -617,7 +617,7 @@ 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 fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 79488)
.With(s => s.OID = 79488)
.With(s => s.Title = "30 Rock")
.Build();