Replaced deprecated NBuilder calls.

pull/6/head
kay.one 13 years ago
parent 956092dbd4
commit f52620db70

@ -9,7 +9,7 @@ namespace NzbDrone.Core.Test.Framework
{
[SetUp]
public void Setup()
public virtual void Setup()
{
ExceptionVerification.Reset();
if (Directory.Exists(TempFolder))

@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test.JobTests
{
//Setup
var fakeSeries = Builder<Series>.CreateListOfSize(10)
.WhereRandom(2)
.Random(2)
.With(s => s.BannerUrl = null)
.Build();

@ -49,8 +49,8 @@ namespace NzbDrone.Core.Test.JobTests
public void job_with_no_target_should_scan_all_series()
{
var series = Builder<Series>.CreateListOfSize(2)
.TheFirst(1).Has(s => s.SeriesId = 12)
.AndTheNext(1).Has(s => s.SeriesId = 15)
.TheFirst(1).With(s => s.SeriesId = 12)
.TheNext(1).With(s => s.SeriesId = 15)
.Build();
var mocker = new AutoMoqer(MockBehavior.Strict);
@ -77,8 +77,8 @@ namespace NzbDrone.Core.Test.JobTests
public void failed_scan_should_not_terminated_job()
{
var series = Builder<Series>.CreateListOfSize(2)
.TheFirst(1).Has(s => s.SeriesId = 12)
.AndTheNext(1).Has(s => s.SeriesId = 15)
.TheFirst(1).With(s => s.SeriesId = 12)
.TheNext(1).With(s => s.SeriesId = 15)
.Build();
var mocker = new AutoMoqer(MockBehavior.Strict);
@ -106,8 +106,8 @@ namespace NzbDrone.Core.Test.JobTests
public void job_with_no_target_should_scan_series_with_episodes()
{
var series = Builder<Series>.CreateListOfSize(2)
.TheFirst(1).Has(s => s.SeriesId = 12)
.AndTheNext(1).Has(s => s.SeriesId = 15)
.TheFirst(1).With(s => s.SeriesId = 12)
.TheNext(1).With(s => s.SeriesId = 15)
.Build();
var mocker = new AutoMoqer(MockBehavior.Strict);

@ -23,8 +23,8 @@ namespace NzbDrone.Core.Test.JobTests
{
var series = Builder<Series>.CreateListOfSize(2)
.All().With(s => s.LastInfoSync = null)
.TheFirst(1).Has(s => s.SeriesId = 12)
.AndTheNext(1).Has(s => s.SeriesId = 15)
.TheFirst(1).With(s => s.SeriesId = 12)
.TheNext(1).With(s => s.SeriesId = 15)
.Build();
var notification = new ProgressNotification("Test");
@ -88,8 +88,8 @@ namespace NzbDrone.Core.Test.JobTests
{
var series = Builder<Series>.CreateListOfSize(2)
.All().With(s => s.LastInfoSync = null)
.TheFirst(1).Has(s => s.SeriesId = 12)
.AndTheNext(1).Has(s => s.SeriesId = 15)
.TheFirst(1).With(s => s.SeriesId = 12)
.TheNext(1).With(s => s.SeriesId = 15)
.Build();
var notification = new ProgressNotification("Test");

@ -25,9 +25,9 @@ namespace NzbDrone.Core.Test.ProviderTests
.Build();
var episodes = Builder<Episode>.CreateListOfSize(2)
.TheFirst(1).Has(s => s.EpisodeId = 12)
.AndTheNext(1).Has(s => s.EpisodeId = 99)
.All().Has(s => s.SeriesId = 5)
.TheFirst(1).With(s => s.EpisodeId = 12)
.TheNext(1).With(s => s.EpisodeId = 99)
.All().With(s => s.SeriesId = 5)
.Build();

@ -338,8 +338,8 @@ namespace NzbDrone.Core.Test.ProviderTests
All()
.With(l => l.Language = new TvdbLanguage(0, "eng", "a"))
.TheFirst(1)
.Has(e => e.EpisodeNumber = 0)
.Has(e => e.SeasonNumber = 15)
.With(e => e.EpisodeNumber = 0)
.With(e => e.SeasonNumber = 15)
.Build())
).With(c => c.Id = seriesId).Build();
@ -1183,7 +1183,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.With(c => c.Ignored = true)
.TheFirst(2)
.With(c => c.EpisodeFileId = 0)
.WhereSection(1, 2)
.Section(1, 2)
.With(c => c.Ignored = false)
.Build().ToList();
@ -1230,7 +1230,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.With(c => c.Ignored = true)
.TheFirst(2)
.With(c => c.EpisodeFileId = 0)
.WhereSection(1, 2)
.Section(1, 2)
.With(c => c.Ignored = false)
.Build().ToList();

@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.ProviderTests
var episodes = Builder<Episode>.CreateListOfSize(10).Build();
var historyItems = Builder<History>.CreateListOfSize(10).TheFirst(5).With(h => h.SeriesId = seriesOne.SeriesId).WhereTheLast(5).With(h => h.SeriesId = seriesTwo.SeriesId).Build();
var historyItems = Builder<History>.CreateListOfSize(10).TheFirst(5).With(h => h.SeriesId = seriesOne.SeriesId).TheLast(5).With(h => h.SeriesId = seriesTwo.SeriesId).Build();
var mocker = new AutoMoqer();
var db = MockLib.GetEmptyDatabase();
@ -95,7 +95,7 @@ namespace NzbDrone.Core.Test.ProviderTests
//Setup
var historyItem = Builder<History>.CreateListOfSize(20)
.TheFirst(10).With(c => c.Date = DateTime.Now)
.AndTheNext(10).With(c => c.Date = DateTime.Now.AddDays(-31))
.TheNext(10).With(c => c.Date = DateTime.Now.AddDays(-31))
.Build();
var mocker = new AutoMoqer();

@ -18,8 +18,9 @@ namespace NzbDrone.Core.Test.ProviderTests
public class JobProviderTest : TestBase
{
[TestFixtureSetUp]
public void Setup()
public override void Setup()
{
base.Setup();
JobProvider.Queue.Clear();
}

@ -23,22 +23,22 @@ namespace NzbDrone.Core.Test.ProviderTests
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
.TheFirst(1)
.Has(f => f.EpisodeFileId = 1)
.Has(f => f.Path = @"C:\Test\Title1.avi")
.AndTheNext(1)
.Has(f => f.EpisodeFileId = 2)
.Has(f => f.Path = @"C:\Test\Title2.avi")
.With(f => f.EpisodeFileId = 1)
.With(f => f.Path = @"C:\Test\Title1.avi")
.TheNext(1)
.With(f => f.EpisodeFileId = 2)
.With(f => f.Path = @"C:\Test\Title2.avi")
.Build();
var episodes = Builder<Episode>.CreateListOfSize(2)
.All()
.With(e => e.Series = series)
.TheFirst(1)
.Has(e => e.EpisodeFileId = 1)
.Has(e => e.EpisodeFile = episodeFiles[0])
.AndTheNext(1)
.Has(e => e.EpisodeFileId = 2)
.Has(e => e.EpisodeFile = episodeFiles[1])
.With(e => e.EpisodeFileId = 1)
.With(e => e.EpisodeFile = episodeFiles[0])
.TheNext(1)
.With(e => e.EpisodeFileId = 2)
.With(e => e.EpisodeFile = episodeFiles[1])
.Build();
var mocker = new AutoMoqer(MockBehavior.Strict);
@ -72,22 +72,22 @@ namespace NzbDrone.Core.Test.ProviderTests
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
.TheFirst(1)
.Has(f => f.EpisodeFileId = 1)
.Has(f => f.Path = @"C:\Test\Title1.avi")
.AndTheNext(1)
.Has(f => f.EpisodeFileId = 2)
.Has(f => f.Path = @"C:\Test\Title2.avi")
.With(f => f.EpisodeFileId = 1)
.With(f => f.Path = @"C:\Test\Title1.avi")
.TheNext(1)
.With(f => f.EpisodeFileId = 2)
.With(f => f.Path = @"C:\Test\Title2.avi")
.Build();
var episodes = Builder<Episode>.CreateListOfSize(2)
.All()
.With(e => e.Series = series)
.TheFirst(1)
.Has(e => e.EpisodeFileId = 1)
.Has(e => e.EpisodeFile = episodeFiles[0])
.AndTheNext(1)
.Has(e => e.EpisodeFileId = 2)
.Has(e => e.EpisodeFile = episodeFiles[1])
.With(e => e.EpisodeFileId = 1)
.With(e => e.EpisodeFile = episodeFiles[0])
.TheNext(1)
.With(e => e.EpisodeFileId = 2)
.With(e => e.EpisodeFile = episodeFiles[1])
.Build();
var mocker = new AutoMoqer(MockBehavior.Strict);
@ -121,22 +121,22 @@ namespace NzbDrone.Core.Test.ProviderTests
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
.TheFirst(1)
.Has(f => f.EpisodeFileId = 1)
.Has(f => f.Path = @"C:\Test\Title1.avi")
.AndTheNext(1)
.Has(f => f.EpisodeFileId = 2)
.Has(f => f.Path = @"C:\Test\Title2.avi")
.With(f => f.EpisodeFileId = 1)
.With(f => f.Path = @"C:\Test\Title1.avi")
.TheNext(1)
.With(f => f.EpisodeFileId = 2)
.With(f => f.Path = @"C:\Test\Title2.avi")
.Build();
var episodes = Builder<Episode>.CreateListOfSize(2)
.All()
.With(e => e.Series = series)
.TheFirst(1)
.Has(e => e.EpisodeFileId = 1)
.Has(e => e.EpisodeFile = episodeFiles[0])
.AndTheNext(1)
.Has(e => e.EpisodeFileId = 2)
.Has(e => e.EpisodeFile = episodeFiles[1])
.With(e => e.EpisodeFileId = 1)
.With(e => e.EpisodeFile = episodeFiles[0])
.TheNext(1)
.With(e => e.EpisodeFileId = 2)
.With(e => e.EpisodeFile = episodeFiles[1])
.Build();
var mocker = new AutoMoqer(MockBehavior.Strict);
@ -172,22 +172,22 @@ namespace NzbDrone.Core.Test.ProviderTests
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
.TheFirst(1)
.Has(f => f.EpisodeFileId = 1)
.Has(f => f.Path = @"C:\Test\Title1.avi")
.AndTheNext(1)
.Has(f => f.EpisodeFileId = 2)
.Has(f => f.Path = @"C:\Test\Title2.avi")
.With(f => f.EpisodeFileId = 1)
.With(f => f.Path = @"C:\Test\Title1.avi")
.TheNext(1)
.With(f => f.EpisodeFileId = 2)
.With(f => f.Path = @"C:\Test\Title2.avi")
.Build();
var episodes = Builder<Episode>.CreateListOfSize(3)
.All()
.With(e => e.Series = series)
.TheFirst(2)
.Has(e => e.EpisodeFileId = 1)
.Has(e => e.EpisodeFile = episodeFiles[0])
.AndTheNext(1)
.Has(e => e.EpisodeFileId = 2)
.Has(e => e.EpisodeFile = episodeFiles[1])
.With(e => e.EpisodeFileId = 1)
.With(e => e.EpisodeFile = episodeFiles[0])
.TheNext(1)
.With(e => e.EpisodeFileId = 2)
.With(e => e.EpisodeFile = episodeFiles[1])
.Build();
var mocker = new AutoMoqer(MockBehavior.Strict);
@ -223,22 +223,22 @@ namespace NzbDrone.Core.Test.ProviderTests
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
.TheFirst(1)
.Has(f => f.EpisodeFileId = 1)
.Has(f => f.Path = @"C:\Test\Title1.avi")
.AndTheNext(1)
.Has(f => f.EpisodeFileId = 2)
.Has(f => f.Path = @"C:\Test\Title2.avi")
.With(f => f.EpisodeFileId = 1)
.With(f => f.Path = @"C:\Test\Title1.avi")
.TheNext(1)
.With(f => f.EpisodeFileId = 2)
.With(f => f.Path = @"C:\Test\Title2.avi")
.Build();
var episodes = Builder<Episode>.CreateListOfSize(3)
.All()
.With(e => e.Series = series)
.TheFirst(2)
.Has(e => e.EpisodeFileId = 1)
.Has(e => e.EpisodeFile = episodeFiles[0])
.AndTheNext(1)
.Has(e => e.EpisodeFileId = 2)
.Has(e => e.EpisodeFile = episodeFiles[1])
.With(e => e.EpisodeFileId = 1)
.With(e => e.EpisodeFile = episodeFiles[0])
.TheNext(1)
.With(e => e.EpisodeFileId = 2)
.With(e => e.EpisodeFile = episodeFiles[1])
.Build();
var mocker = new AutoMoqer(MockBehavior.Strict);

@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.ProviderTests
{
var parseResults = Builder<EpisodeParseResult>.CreateListOfSize(10)
.All().With(c => c.Quality = new Quality(QualityTypes.DVD, true))
.WhereRandom(1).Has(c => c.Quality = new Quality(QualityTypes.Bluray1080p, true))
.Random(1).With(c => c.Quality = new Quality(QualityTypes.Bluray1080p, true))
.Build();
var episode = Builder<Episode>.CreateNew().Build();
@ -91,7 +91,7 @@ namespace NzbDrone.Core.Test.ProviderTests
{
var parseResults = Builder<EpisodeParseResult>.CreateListOfSize(20)
.All().With(c => c.Quality = new Quality(QualityTypes.DVD, false))
.WhereRandom(1).Has(c => c.Quality = new Quality(QualityTypes.DVD, true))
.Random(1).With(c => c.Quality = new Quality(QualityTypes.DVD, true))
.Build();
parseResults.Where(c => c.Quality.Proper).Should().HaveCount(1);

@ -183,10 +183,10 @@ namespace NzbDrone.Core.Test.ProviderTests
var parseResults = Builder<EpisodeParseResult>.CreateListOfSize(4)
.TheFirst(1)
.Has(p => p.CleanTitle = "title")
.Has(p => p.SeasonNumber = 1)
.Has(p => p.FullSeason = true)
.Has(p => p.EpisodeNumbers = null)
.With(p => p.CleanTitle = "title")
.With(p => p.SeasonNumber = 1)
.With(p => p.FullSeason = true)
.With(p => p.EpisodeNumbers = null)
.Build();
var mocker = new AutoMoqer(MockBehavior.Strict);

@ -37,10 +37,10 @@ namespace NzbDrone.Core.Test.ProviderTests
var parseResults = Builder<EpisodeParseResult>.CreateListOfSize(4)
.TheFirst(1)
.Has(p => p.CleanTitle = "title")
.Has(p => p.SeasonNumber = 1)
.Has(p => p.FullSeason = true)
.Has(p => p.EpisodeNumbers = null)
.With(p => p.CleanTitle = "title")
.With(p => p.SeasonNumber = 1)
.With(p => p.FullSeason = true)
.With(p => p.EpisodeNumbers = null)
.Build();
var mocker = new AutoMoqer(MockBehavior.Strict);
@ -149,10 +149,10 @@ namespace NzbDrone.Core.Test.ProviderTests
var parseResults = Builder<EpisodeParseResult>.CreateListOfSize(4)
.TheFirst(1)
.Has(p => p.CleanTitle = "title")
.Has(p => p.SeasonNumber = 1)
.Has(p => p.FullSeason = true)
.Has(p => p.EpisodeNumbers = null)
.With(p => p.CleanTitle = "title")
.With(p => p.SeasonNumber = 1)
.With(p => p.FullSeason = true)
.With(p => p.EpisodeNumbers = null)
.Build();
var mocker = new AutoMoqer(MockBehavior.Strict);
@ -183,10 +183,10 @@ namespace NzbDrone.Core.Test.ProviderTests
var parseResults = Builder<EpisodeParseResult>.CreateListOfSize(4)
.TheFirst(1)
.Has(p => p.CleanTitle = "title")
.Has(p => p.SeasonNumber = 1)
.Has(p => p.FullSeason = true)
.Has(p => p.EpisodeNumbers = null)
.With(p => p.CleanTitle = "title")
.With(p => p.SeasonNumber = 1)
.With(p => p.FullSeason = true)
.With(p => p.EpisodeNumbers = null)
.Build();
var mocker = new AutoMoqer(MockBehavior.Strict);

@ -220,7 +220,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.With(e => e.AirDate = DateTime.Today)
.TheFirst(5)
.With(e => e.EpisodeFileId = 0)
.WhereTheLast(2)
.TheLast(2)
.With(e => e.AirDate = DateTime.Today.AddDays(1))
.Build();
@ -247,7 +247,7 @@ namespace NzbDrone.Core.Test.ProviderTests
var fakeQuality = Builder<QualityProfile>.CreateNew().Build();
var fakeSeries = Builder<Series>.CreateNew().With(e => e.QualityProfileId = fakeQuality.QualityProfileId).Build();
var fakeEpisodes = Builder<Episode>.CreateListOfSize(10).All().With(e => e.SeriesId = fakeSeries.SeriesId).With(e => e.Ignored = true).WhereRandom(5).With(e => e.EpisodeFileId = 0).Build();
var fakeEpisodes = Builder<Episode>.CreateListOfSize(10).All().With(e => e.SeriesId = fakeSeries.SeriesId).With(e => e.Ignored = true).Random(5).With(e => e.EpisodeFileId = 0).Build();
db.Insert(fakeSeries);
db.Insert(fakeQuality);
@ -308,7 +308,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.With(e => e.AirDate = DateTime.Today.AddDays(-1))
.TheFirst(5)
.With(e => e.Ignored = false)
.WhereTheLast(5)
.TheLast(5)
.With(e => e.Ignored = true)
.Build();
@ -638,8 +638,8 @@ namespace NzbDrone.Core.Test.ProviderTests
var fakeQuality = Builder<QualityProfile>.CreateNew().Build();
var fakeSeries = Builder<Series>.CreateListOfSize(10)
.WhereAll()
.Have(e => e.QualityProfileId = fakeQuality.QualityProfileId)
.All()
.With(e => e.QualityProfileId = fakeQuality.QualityProfileId)
.Build();
db.InsertMany(fakeSeries);
@ -661,8 +661,8 @@ namespace NzbDrone.Core.Test.ProviderTests
var fakeQuality = Builder<QualityProfile>.CreateNew().Build();
var fakeSeries = Builder<Series>.CreateListOfSize(10)
.WhereAll()
.Have(e => e.QualityProfileId = fakeQuality.QualityProfileId)
.All()
.With(e => e.QualityProfileId = fakeQuality.QualityProfileId)
.Build();
db.InsertMany(fakeSeries);
@ -684,8 +684,8 @@ namespace NzbDrone.Core.Test.ProviderTests
var fakeQuality = Builder<QualityProfile>.CreateNew().Build();
var fakeSeries = Builder<Series>.CreateListOfSize(10)
.WhereAll()
.Have(e => e.QualityProfileId = fakeQuality.QualityProfileId)
.All()
.With(e => e.QualityProfileId = fakeQuality.QualityProfileId)
.Build();
db.InsertMany(fakeSeries);
@ -707,8 +707,8 @@ namespace NzbDrone.Core.Test.ProviderTests
var fakeQuality = Builder<QualityProfile>.CreateNew().Build();
var fakeSeries = Builder<Series>.CreateListOfSize(10)
.WhereAll()
.Have(e => e.QualityProfileId = fakeQuality.QualityProfileId)
.All()
.With(e => e.QualityProfileId = fakeQuality.QualityProfileId)
.Build();
db.InsertMany(fakeSeries);

@ -28,17 +28,17 @@ namespace NzbDrone.Core.Test.ProviderTests
.With(e => e.SeriesId = 1)
.With(e => e.Ignored = false)
.TheFirst(1)
.Has(e => e.AirDate = DateTime.Today.AddDays(-1))
.AndTheNext(1)
.Has(e => e.AirDate = DateTime.Today)
.AndTheNext(1)
.Has(e => e.AirDate = DateTime.Today.AddDays(1))
.AndTheNext(1)
.Has(e => e.AirDate = DateTime.Today.AddDays(2))
.AndTheNext(1)
.Has(e => e.AirDate = DateTime.Today.AddDays(7))
.AndTheNext(1)
.Has(e => e.AirDate = DateTime.Today.AddDays(9))
.With(e => e.AirDate = DateTime.Today.AddDays(-1))
.TheNext(1)
.With(e => e.AirDate = DateTime.Today)
.TheNext(1)
.With(e => e.AirDate = DateTime.Today.AddDays(1))
.TheNext(1)
.With(e => e.AirDate = DateTime.Today.AddDays(2))
.TheNext(1)
.With(e => e.AirDate = DateTime.Today.AddDays(7))
.TheNext(1)
.With(e => e.AirDate = DateTime.Today.AddDays(9))
.Build();
series = Builder<Series>.CreateNew().With(s => s.SeriesId = 1).Build();

Loading…
Cancel
Save