1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00

Replaced deprecated NBuilder calls.

This commit is contained in:
kay.one 2011-10-22 22:39:14 -07:00
parent 956092dbd4
commit f52620db70
14 changed files with 114 additions and 113 deletions

View File

@ -9,7 +9,7 @@ public class TestBase
{
[SetUp]
public void Setup()
public virtual void Setup()
{
ExceptionVerification.Reset();
if (Directory.Exists(TempFolder))

View File

@ -54,7 +54,7 @@ public void BannerDownload_some_null_BannerUrl()
{
//Setup
var fakeSeries = Builder<Series>.CreateListOfSize(10)
.WhereRandom(2)
.Random(2)
.With(s => s.BannerUrl = null)
.Build();

View File

@ -49,8 +49,8 @@ public void series_specific_scan_should_scan_series()
public void job_with_no_target_should_scan_all_series()
{
var series = Builder<Series>.CreateListOfSize(2)
.TheFirst(1).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 @@ public void job_with_no_target_should_scan_all_series()
public void failed_scan_should_not_terminated_job()
{
var series = Builder<Series>.CreateListOfSize(2)
.TheFirst(1).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 @@ public void failed_scan_should_not_terminated_job()
public void job_with_no_target_should_scan_series_with_episodes()
{
var series = Builder<Series>.CreateListOfSize(2)
.TheFirst(1).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);

View File

@ -23,8 +23,8 @@ public void import_new_series_succesfull()
{
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 @@ public void failed_import_should_not_be_stuck_in_loop()
{
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");

View File

@ -25,9 +25,9 @@ public void Download_report_should_send_to_sab_add_to_history_mark_as_grabbed()
.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();

View File

@ -338,8 +338,8 @@ public void RefreshEpisodeInfo_ignore_episode_zero()
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 @@ public void EpisodesWithoutFiles_no_specials()
.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 @@ public void EpisodesWithoutFiles_with_specials()
.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();

View File

@ -44,7 +44,7 @@ public void AllItemsWithRelationships()
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 @@ public void Trim_Items()
//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();

View File

@ -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();
}
@ -415,7 +416,7 @@ public void existing_queue_should_start_queue_if_not_running()
TargetId = 12,
SecondaryTargetId = 0
};
//Act
var jobProvider = mocker.Resolve<JobProvider>();
jobProvider.Initialize();

View File

@ -23,22 +23,22 @@ public void no_misnamed_files()
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 @@ public void all_misnamed_files()
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 @@ public void one_misnamed_file()
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 @@ public void misnamed_multi_episode_file()
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 @@ public void no_misnamed_multi_episode_file()
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);

View File

@ -55,7 +55,7 @@ public void processResults_higher_quality_should_be_called_first()
{
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 @@ public void processResults_when_same_quality_proper_should_be_called_first()
{
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);

View File

@ -183,10 +183,10 @@ public void ProcessPartialSeasonSearchResults_failure()
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);

View File

@ -37,10 +37,10 @@ public void SeasonSearch_season_success()
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 @@ public void ProcessSeasonSearchResults_success()
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 @@ public void ProcessSeasonSearchResults_failure()
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);

View File

@ -220,7 +220,7 @@ public void Get_Series_With_Count()
.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 @@ public void Get_Series_With_Count_AllIgnored()
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 @@ public void Get_Series_With_Count_Half_Ignored()
.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 @@ public void SearchForSeries_should_return_results_that_start_with_query()
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 @@ public void SearchForSeries_should_return_results_that_contain_the_query()
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 @@ public void SearchForSeries_should_return_results_that_end_with_the_query()
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 @@ public void SearchForSeries_should_not_return_results_that_do_not_contain_the_qu
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);

View File

@ -28,17 +28,17 @@ public class UpcomingEpisodesProviderTest : TestBase
.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();