|
|
@ -17,7 +17,7 @@ using NzbDrone.Core.Repository.Quality;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Test.Common.AutoMoq;
|
|
|
|
using NzbDrone.Test.Common.AutoMoq;
|
|
|
|
using PetaPoco;
|
|
|
|
using PetaPoco;
|
|
|
|
using TvdbLib.Data;
|
|
|
|
using XemLib.Data;
|
|
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -161,7 +161,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
c => c.Episodes =
|
|
|
|
c => c.Episodes =
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(episodeCount).
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(episodeCount).
|
|
|
|
All()
|
|
|
|
All()
|
|
|
|
.With(l => l.Language = new TvdbLanguage(0, "eng", "a"))
|
|
|
|
.With(l => l.Language = "en")
|
|
|
|
.Build())
|
|
|
|
.Build())
|
|
|
|
).With(c => c.Id = seriesId).Build();
|
|
|
|
).With(c => c.Id = seriesId).Build();
|
|
|
|
|
|
|
|
|
|
|
@ -172,7 +172,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
@ -195,7 +195,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
c => c.Episodes =
|
|
|
|
c => c.Episodes =
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(10).
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(10).
|
|
|
|
All()
|
|
|
|
All()
|
|
|
|
.With(l => l.Language = new TvdbLanguage(0, "eng", "a")).And(e => e.FirstAired = DateTime.Now)
|
|
|
|
.With(l => l.Language = "en").And(e => e.FirstAired = DateTime.Now)
|
|
|
|
.TheFirst(7).With(e => e.FirstAired = new DateTime(1800, 1, 1))
|
|
|
|
.TheFirst(7).With(e => e.FirstAired = new DateTime(1800, 1, 1))
|
|
|
|
.Build())
|
|
|
|
.Build())
|
|
|
|
).With(c => c.Id = seriesId).Build();
|
|
|
|
).With(c => c.Id = seriesId).Build();
|
|
|
@ -207,7 +207,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -236,7 +236,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
c => c.Episodes =
|
|
|
|
c => c.Episodes =
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(1)
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(1)
|
|
|
|
.All()
|
|
|
|
.All()
|
|
|
|
.With(l => l.Language = new TvdbLanguage(0, "eng", "a")).And(e => e.FirstAired = DateTime.Now)
|
|
|
|
.With(l => l.Language = "en").And(e => e.FirstAired = DateTime.Now)
|
|
|
|
.TheFirst(1).With(e => e.FirstAired = new DateTime(1800, 1, 1))
|
|
|
|
.TheFirst(1).With(e => e.FirstAired = new DateTime(1800, 1, 1))
|
|
|
|
.Build())
|
|
|
|
.Build())
|
|
|
|
).With(c => c.Id = seriesId).Build();
|
|
|
|
).With(c => c.Id = seriesId).Build();
|
|
|
@ -248,7 +248,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
Db.Insert(fakeEpisode);
|
|
|
|
Db.Insert(fakeEpisode);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(fakeTvDbEpisodes);
|
|
|
|
.Returns(fakeTvDbEpisodes);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
@ -271,7 +271,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
c => c.Episodes =
|
|
|
|
c => c.Episodes =
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(episodeCount).
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(episodeCount).
|
|
|
|
All()
|
|
|
|
All()
|
|
|
|
.With(l => l.Language = new TvdbLanguage(0, "eng", "a"))
|
|
|
|
.With(l => l.Language = "en")
|
|
|
|
.TheFirst(1)
|
|
|
|
.TheFirst(1)
|
|
|
|
.With(e => e.EpisodeNumber = 0)
|
|
|
|
.With(e => e.EpisodeNumber = 0)
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
@ -285,7 +285,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -324,7 +324,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -362,7 +362,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -395,7 +395,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -428,7 +428,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -451,7 +451,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
c => c.Episodes =
|
|
|
|
c => c.Episodes =
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(episodeCount).
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(episodeCount).
|
|
|
|
All()
|
|
|
|
All()
|
|
|
|
.With(l => l.Language = new TvdbLanguage(0, "eng", "a"))
|
|
|
|
.With(l => l.Language = "en")
|
|
|
|
.With(e => e.SeasonNumber = 0)
|
|
|
|
.With(e => e.SeasonNumber = 0)
|
|
|
|
.Build())
|
|
|
|
.Build())
|
|
|
|
).With(c => c.Id = seriesId).Build();
|
|
|
|
).With(c => c.Id = seriesId).Build();
|
|
|
@ -463,7 +463,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
.Returns(fakeEpisodes);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<SeasonProvider>()
|
|
|
|
Mocker.GetMock<SeasonProvider>()
|
|
|
@ -493,7 +493,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
var currentEpisodes = new List<Episode>();
|
|
|
|
var currentEpisodes = new List<Episode>();
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
|
|
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDatabase>()
|
|
|
|
Mocker.GetMock<IDatabase>()
|
|
|
@ -528,7 +528,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
|
|
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDatabase>()
|
|
|
|
Mocker.GetMock<IDatabase>()
|
|
|
@ -565,7 +565,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
.Returns(fakeEpisodeList);
|
|
|
|
.Returns(fakeEpisodeList);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(fakeTvDbResult);
|
|
|
|
.Returns(fakeTvDbResult);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
@ -602,7 +602,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
|
|
|
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = 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, false))
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDatabase>()
|
|
|
|
Mocker.GetMock<IDatabase>()
|
|
|
@ -643,7 +643,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
|
|
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
|
|
|
|
|
|
|
|
var updatedEpisodes = new List<Episode>();
|
|
|
|
var updatedEpisodes = new List<Episode>();
|
|
|
@ -692,7 +692,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
|
|
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
|
|
|
|
|
|
|
|
var updatedEpisodes = new List<Episode>();
|
|
|
|
var updatedEpisodes = new List<Episode>();
|
|
|
@ -738,7 +738,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
|
|
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
|
|
|
|
|
|
|
|
var updatedEpisodes = new List<Episode>();
|
|
|
|
var updatedEpisodes = new List<Episode>();
|
|
|
@ -777,7 +777,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
c => c.Episodes =
|
|
|
|
c => c.Episodes =
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(episodeCount).
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(episodeCount).
|
|
|
|
All()
|
|
|
|
All()
|
|
|
|
.With(l => l.Language = new TvdbLanguage(0, "eng", "a"))
|
|
|
|
.With(l => l.Language = "en")
|
|
|
|
.With(e => e.SeasonNumber = 5)
|
|
|
|
.With(e => e.SeasonNumber = 5)
|
|
|
|
.TheFirst(1)
|
|
|
|
.TheFirst(1)
|
|
|
|
.With(e => e.EpisodeNumber = 1)
|
|
|
|
.With(e => e.EpisodeNumber = 1)
|
|
|
@ -796,7 +796,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
Db.Insert(fakeEpisode);
|
|
|
|
Db.Insert(fakeEpisode);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<SeasonProvider>()
|
|
|
|
Mocker.GetMock<SeasonProvider>()
|
|
|
@ -1486,7 +1486,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
c => c.Episodes =
|
|
|
|
c => c.Episodes =
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(episodeCount).
|
|
|
|
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(episodeCount).
|
|
|
|
All()
|
|
|
|
All()
|
|
|
|
.With(l => l.Language = new TvdbLanguage(0, "eng", "a"))
|
|
|
|
.With(l => l.Language = "en")
|
|
|
|
.With(e => e.EpisodeNumber = 0)
|
|
|
|
.With(e => e.EpisodeNumber = 0)
|
|
|
|
.TheFirst(1)
|
|
|
|
.TheFirst(1)
|
|
|
|
.With(e => e.SeasonNumber = 1)
|
|
|
|
.With(e => e.SeasonNumber = 1)
|
|
|
@ -1508,7 +1508,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
Mocker.GetMock<TvDbProvider>()
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
|
|
|
.Setup(c => c.GetSeries(seriesId, true, false, false))
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
.Returns(tvdbSeries);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|