diff --git a/NzbDrone.Core.Test/MetadataSourceTests/TraktProxyFixture.cs b/NzbDrone.Core.Test/MetadataSourceTests/TraktProxyFixture.cs index 52715f18c7..ce033fdacb 100644 --- a/NzbDrone.Core.Test/MetadataSourceTests/TraktProxyFixture.cs +++ b/NzbDrone.Core.Test/MetadataSourceTests/TraktProxyFixture.cs @@ -7,6 +7,7 @@ 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 @@ public void should_be_able_to_get_series_detail(int tvdbId) public void getting_details_of_invalid_series() { Assert.Throws(() => Subject.GetSeriesInfo(Int32.MaxValue)); + + ExceptionVerification.ExpectedWarns(1); } private void ValidateSeries(Series series) diff --git a/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithoutFilesFixture.cs b/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithoutFilesFixture.cs index 496bcf77e3..e08d77b235 100644 --- a/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithoutFilesFixture.cs +++ b/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithoutFilesFixture.cs @@ -14,20 +14,24 @@ public class EpisodesWithoutFilesFixture : DbTest private Series _monitoredSeries; private Series _unmonitoredSeries; private PagingSpec _pagingSpec; - + [SetUp] public void Setup() { _monitoredSeries = Builder.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.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 @@ public void Setup() var monitoredSeriesEpisodes = Builder.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 @@ public void Setup() var unmonitoredSeriesEpisodes = Builder.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 @@ public void Setup() .With(e => e.SeasonNumber = 0) .Build(); + Db.InsertMany(monitoredSeriesEpisodes); Db.InsertMany(unmonitoredSeriesEpisodes); } diff --git a/NzbDrone.Core/Datastore/Migration/Framework/NzbDroneMigrationBase.cs b/NzbDrone.Core/Datastore/Migration/Framework/NzbDroneMigrationBase.cs index c641d5f551..a1be291fef 100644 --- a/NzbDrone.Core/Datastore/Migration/Framework/NzbDroneMigrationBase.cs +++ b/NzbDrone.Core/Datastore/Migration/Framework/NzbDroneMigrationBase.cs @@ -33,7 +33,7 @@ public override void Up() } } - public ISQLiteAlter SQLiteAlter { get; private set; } + protected ISQLiteAlter SQLiteAlter { get; private set; } public override void Down() { diff --git a/NzbDrone.Test.Common/TestBase.cs b/NzbDrone.Test.Common/TestBase.cs index 94521c8d5b..266de44630 100644 --- a/NzbDrone.Test.Common/TestBase.cs +++ b/NzbDrone.Test.Common/TestBase.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Threading; using FluentAssertions; using Moq; using NLog; @@ -42,6 +43,9 @@ protected TSubject Subject public abstract class TestBase : LoggingTest { + + private static readonly Random _random = new Random(); + private AutoMoqer _mocker; protected AutoMoqer Mocker { @@ -58,6 +62,15 @@ protected AutoMoqer Mocker protected Mock MockedRestProvider { get; private set; } + protected int RandomNumber + { + get + { + Thread.Sleep(1); + return _random.Next(0, int.MaxValue); + } + } + private string VirtualPath { get