mirror of
https://github.com/Radarr/Radarr
synced 2025-03-03 18:36:41 +00:00
fixed broken tests
This commit is contained in:
parent
16c9232b12
commit
c90a96c2e0
4 changed files with 25 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
||||||
using NzbDrone.Core.Rest;
|
using NzbDrone.Core.Rest;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
using NzbDrone.Test.Common;
|
||||||
using NzbDrone.Test.Common.Categories;
|
using NzbDrone.Test.Common.Categories;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.MetadataSourceTests
|
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()
|
public void getting_details_of_invalid_series()
|
||||||
{
|
{
|
||||||
Assert.Throws<RestException>(() => Subject.GetSeriesInfo(Int32.MaxValue));
|
Assert.Throws<RestException>(() => Subject.GetSeriesInfo(Int32.MaxValue));
|
||||||
|
|
||||||
|
ExceptionVerification.ExpectedWarns(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ValidateSeries(Series series)
|
private void ValidateSeries(Series series)
|
||||||
|
|
|
@ -14,20 +14,24 @@ public class EpisodesWithoutFilesFixture : DbTest<EpisodeRepository, Episode>
|
||||||
private Series _monitoredSeries;
|
private Series _monitoredSeries;
|
||||||
private Series _unmonitoredSeries;
|
private Series _unmonitoredSeries;
|
||||||
private PagingSpec<Episode> _pagingSpec;
|
private PagingSpec<Episode> _pagingSpec;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_monitoredSeries = Builder<Series>.CreateNew()
|
_monitoredSeries = Builder<Series>.CreateNew()
|
||||||
.With(s => s.Id = 0)
|
.With(s => s.Id = 0)
|
||||||
|
.With(s => s.TvRageId = RandomNumber)
|
||||||
.With(s => s.Runtime = 30)
|
.With(s => s.Runtime = 30)
|
||||||
.With(s => s.Monitored = true)
|
.With(s => s.Monitored = true)
|
||||||
|
.With(s => s.TitleSlug = "Title3")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_unmonitoredSeries = Builder<Series>.CreateNew()
|
_unmonitoredSeries = Builder<Series>.CreateNew()
|
||||||
.With(s => s.Id = 0)
|
.With(s => s.Id = 0)
|
||||||
|
.With(s => s.TvdbId = RandomNumber)
|
||||||
.With(s => s.Runtime = 30)
|
.With(s => s.Runtime = 30)
|
||||||
.With(s => s.Monitored = false)
|
.With(s => s.Monitored = false)
|
||||||
|
.With(s => s.TitleSlug = "Title2")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_monitoredSeries.Id = Db.Insert(_monitoredSeries).Id;
|
_monitoredSeries.Id = Db.Insert(_monitoredSeries).Id;
|
||||||
|
@ -44,6 +48,7 @@ public void Setup()
|
||||||
var monitoredSeriesEpisodes = Builder<Episode>.CreateListOfSize(3)
|
var monitoredSeriesEpisodes = Builder<Episode>.CreateListOfSize(3)
|
||||||
.All()
|
.All()
|
||||||
.With(e => e.Id = 0)
|
.With(e => e.Id = 0)
|
||||||
|
.With(e => e.TvDbEpisodeId = RandomNumber)
|
||||||
.With(e => e.SeriesId = _monitoredSeries.Id)
|
.With(e => e.SeriesId = _monitoredSeries.Id)
|
||||||
.With(e => e.EpisodeFileId = 0)
|
.With(e => e.EpisodeFileId = 0)
|
||||||
.With(e => e.AirDateUtc = DateTime.Now.AddDays(-5))
|
.With(e => e.AirDateUtc = DateTime.Now.AddDays(-5))
|
||||||
|
@ -57,6 +62,7 @@ public void Setup()
|
||||||
var unmonitoredSeriesEpisodes = Builder<Episode>.CreateListOfSize(3)
|
var unmonitoredSeriesEpisodes = Builder<Episode>.CreateListOfSize(3)
|
||||||
.All()
|
.All()
|
||||||
.With(e => e.Id = 0)
|
.With(e => e.Id = 0)
|
||||||
|
.With(e => e.TvDbEpisodeId = RandomNumber)
|
||||||
.With(e => e.SeriesId = _unmonitoredSeries.Id)
|
.With(e => e.SeriesId = _unmonitoredSeries.Id)
|
||||||
.With(e => e.EpisodeFileId = 0)
|
.With(e => e.EpisodeFileId = 0)
|
||||||
.With(e => e.AirDateUtc = DateTime.Now.AddDays(-5))
|
.With(e => e.AirDateUtc = DateTime.Now.AddDays(-5))
|
||||||
|
@ -67,6 +73,7 @@ public void Setup()
|
||||||
.With(e => e.SeasonNumber = 0)
|
.With(e => e.SeasonNumber = 0)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
Db.InsertMany(monitoredSeriesEpisodes);
|
Db.InsertMany(monitoredSeriesEpisodes);
|
||||||
Db.InsertMany(unmonitoredSeriesEpisodes);
|
Db.InsertMany(unmonitoredSeriesEpisodes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public override void Up()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISQLiteAlter SQLiteAlter { get; private set; }
|
protected ISQLiteAlter SQLiteAlter { get; private set; }
|
||||||
|
|
||||||
public override void Down()
|
public override void Down()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
@ -42,6 +43,9 @@ protected TSubject Subject
|
||||||
|
|
||||||
public abstract class TestBase : LoggingTest
|
public abstract class TestBase : LoggingTest
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static readonly Random _random = new Random();
|
||||||
|
|
||||||
private AutoMoqer _mocker;
|
private AutoMoqer _mocker;
|
||||||
protected AutoMoqer Mocker
|
protected AutoMoqer Mocker
|
||||||
{
|
{
|
||||||
|
@ -58,6 +62,15 @@ protected AutoMoqer Mocker
|
||||||
|
|
||||||
protected Mock<RestProvider> MockedRestProvider { get; private set; }
|
protected Mock<RestProvider> MockedRestProvider { get; private set; }
|
||||||
|
|
||||||
|
protected int RandomNumber
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Thread.Sleep(1);
|
||||||
|
return _random.Next(0, int.MaxValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private string VirtualPath
|
private string VirtualPath
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
Loading…
Reference in a new issue