fixed broken tests

pull/30/head
kay.one 11 years ago
parent 16c9232b12
commit c90a96c2e0

@ -7,6 +7,7 @@ using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Rest;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Test.Common;
using NzbDrone.Test.Common.Categories;
namespace NzbDrone.Core.Test.MetadataSourceTests
@ -51,6 +52,8 @@ namespace NzbDrone.Core.Test.MetadataSourceTests
public void getting_details_of_invalid_series()
{
Assert.Throws<RestException>(() => Subject.GetSeriesInfo(Int32.MaxValue));
ExceptionVerification.ExpectedWarns(1);
}
private void ValidateSeries(Series series)

@ -14,20 +14,24 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
private Series _monitoredSeries;
private Series _unmonitoredSeries;
private PagingSpec<Episode> _pagingSpec;
[SetUp]
public void Setup()
{
_monitoredSeries = Builder<Series>.CreateNew()
.With(s => s.Id = 0)
.With(s => s.TvRageId = RandomNumber)
.With(s => s.Runtime = 30)
.With(s => s.Monitored = true)
.With(s => s.TitleSlug = "Title3")
.Build();
_unmonitoredSeries = Builder<Series>.CreateNew()
.With(s => s.Id = 0)
.With(s => s.TvdbId = RandomNumber)
.With(s => s.Runtime = 30)
.With(s => s.Monitored = false)
.With(s => s.TitleSlug = "Title2")
.Build();
_monitoredSeries.Id = Db.Insert(_monitoredSeries).Id;
@ -44,6 +48,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
var monitoredSeriesEpisodes = Builder<Episode>.CreateListOfSize(3)
.All()
.With(e => e.Id = 0)
.With(e => e.TvDbEpisodeId = RandomNumber)
.With(e => e.SeriesId = _monitoredSeries.Id)
.With(e => e.EpisodeFileId = 0)
.With(e => e.AirDateUtc = DateTime.Now.AddDays(-5))
@ -57,6 +62,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
var unmonitoredSeriesEpisodes = Builder<Episode>.CreateListOfSize(3)
.All()
.With(e => e.Id = 0)
.With(e => e.TvDbEpisodeId = RandomNumber)
.With(e => e.SeriesId = _unmonitoredSeries.Id)
.With(e => e.EpisodeFileId = 0)
.With(e => e.AirDateUtc = DateTime.Now.AddDays(-5))
@ -67,6 +73,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
.With(e => e.SeasonNumber = 0)
.Build();
Db.InsertMany(monitoredSeriesEpisodes);
Db.InsertMany(unmonitoredSeriesEpisodes);
}

@ -33,7 +33,7 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
}
}
public ISQLiteAlter SQLiteAlter { get; private set; }
protected ISQLiteAlter SQLiteAlter { get; private set; }
public override void Down()
{

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Threading;
using FluentAssertions;
using Moq;
using NLog;
@ -42,6 +43,9 @@ namespace NzbDrone.Test.Common
public abstract class TestBase : LoggingTest
{
private static readonly Random _random = new Random();
private AutoMoqer _mocker;
protected AutoMoqer Mocker
{
@ -58,6 +62,15 @@ namespace NzbDrone.Test.Common
protected Mock<RestProvider> MockedRestProvider { get; private set; }
protected int RandomNumber
{
get
{
Thread.Sleep(1);
return _random.Next(0, int.MaxValue);
}
}
private string VirtualPath
{
get

Loading…
Cancel
Save