more fixed tests.

pull/3113/head
kay.one 12 years ago
parent 9931bab998
commit 1d78bb7210

@ -6,6 +6,7 @@ using NzbDrone.Api.QualityType;
using NzbDrone.Api.Resolvers;
using NzbDrone.Api.Series;
using NzbDrone.Api.Upcoming;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Tv;

@ -7,6 +7,7 @@ using FluentValidation;
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Common;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Model;
@ -58,7 +59,7 @@ namespace NzbDrone.Api.Series
//(we can just create the folder and it won't blow up if it already exists)
//We also need to remove any special characters from the filename before attempting to create it
_seriesService.AddSeries("", request.Path, request.SeriesId, request.QualityProfileId, null);
_seriesService.AddSeries("", request.Path, request.OID, request.QualityProfileId, null);
_jobProvider.QueueJob(typeof(ImportNewSeriesJob));
return new Response { StatusCode = HttpStatusCode.Created };
@ -116,7 +117,7 @@ namespace NzbDrone.Api.Series
{
RuleSet("POST", () =>
{
RuleFor(s => s.OID).GreaterThan(0);
RuleFor(s => ((ModelBase)s).OID).GreaterThan(0);
RuleFor(s => s.Path).NotEmpty().Must(_diskProvider.FolderExists);
RuleFor(s => s.QualityProfileId).GreaterThan(0);
});

@ -66,9 +66,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
firstQuality = new QualityModel(QualityTypes.Bluray1080p, true);
secondQuality = new QualityModel(QualityTypes.Bluray1080p, true);
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 3)).Returns(firstQuality);
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 4)).Returns(secondQuality);
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 5)).Returns<QualityModel>(null);
Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 3)).Returns(firstQuality);
Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 4)).Returns(secondQuality);
Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 5)).Returns<QualityModel>(null);
}
private void WithFirstReportUpgradable()
@ -124,7 +124,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
parseResultSingle.Quality = new QualityModel(QualityTypes.WEBDL1080p, false);
firstQuality = new QualityModel(QualityTypes.WEBDL1080p, false);
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 3)).Returns(firstQuality);
Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 3)).Returns(firstQuality);
_upgradeHistory.IsSatisfiedBy(parseResultSingle).Should().BeFalse();
}

@ -12,12 +12,11 @@ namespace NzbDrone.Core.Test
[TestFixture]
// ReSharper disable InconsistentNaming
public class EpisodeStatusTest : CoreTest
{
{
[TestCase(1, false, false, EpisodeStatusType.NotAired)]
[TestCase(-2, false, false, EpisodeStatusType.Missing)]
[TestCase(0, false, false, EpisodeStatusType.AirsToday)]
[TestCase(1, true, false, EpisodeStatusType.Ready)]
[TestCase(0, true, false, EpisodeStatusType.Ready)]
public void no_grab_date(int offsetDays, bool hasEpisodes, bool ignored, EpisodeStatusType status)
{
Episode episode = Builder<Episode>.CreateNew()
@ -31,7 +30,7 @@ namespace NzbDrone.Core.Test
episode.EpisodeFile = new EpisodeFile();
}
Assert.AreEqual(status, episode.Status);
episode.Status.Should().Be(status);
}
[TestCase(1, false, false, EpisodeStatusType.Missing)]
@ -73,7 +72,8 @@ namespace NzbDrone.Core.Test
episode.EpisodeFile = new EpisodeFile();
}
Assert.AreEqual(status, episode.Status);
episode.Status.Should().Be(status);
}
[TestCase(1, true, true, EpisodeStatusType.Ready)]
@ -90,7 +90,8 @@ namespace NzbDrone.Core.Test
episode.EpisodeFile = new EpisodeFile();
}
Assert.AreEqual(status, episode.Status);
episode.Status.Should().Be(status);
}
[Test]
@ -124,7 +125,8 @@ namespace NzbDrone.Core.Test
episode.EpisodeFile = new EpisodeFile();
}
Assert.AreEqual(status, episode.Status);
episode.Status.Should().Be(status);
}
}
}

@ -25,10 +25,10 @@ namespace NzbDrone.Core.Test.JobTests
var notification = new ProgressNotification("Series Search");
Mocker.GetMock<SeasonRepository>()
Mocker.GetMock<ISeasonRepository>()
.Setup(c => c.GetSeasonNumbers(1)).Returns(seasons);
Mocker.GetMock<SeasonRepository>()
Mocker.GetMock<ISeasonRepository>()
.Setup(c => c.IsIgnored(It.IsAny<int>(), It.IsAny<int>())).Returns(false);
Mocker.GetMock<SeasonSearchJob>()
@ -52,7 +52,7 @@ namespace NzbDrone.Core.Test.JobTests
var notification = new ProgressNotification("Series Search");
Mocker.GetMock<SeasonRepository>()
Mocker.GetMock<ISeasonRepository>()
.Setup(c => c.GetSeasonNumbers(1)).Returns(seasons);
//Act
@ -67,7 +67,7 @@ namespace NzbDrone.Core.Test.JobTests
[Test]
public void SeriesSearch_should_not_search_for_season_0()
{
Mocker.GetMock<SeasonRepository>()
Mocker.GetMock<ISeasonRepository>()
.Setup(c => c.GetSeasonNumbers(It.IsAny<int>()))
.Returns(new List<int> { 0, 1, 2 });

@ -462,7 +462,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Setup(c => c.GetSeries(seriesId, true, false))
.Returns(fakeEpisodes);
Mocker.GetMock<SeasonRepository>()
Mocker.GetMock<ISeasonRepository>()
.Setup(s => s.IsIgnored(seriesId, 0))
.Returns(true);
@ -795,7 +795,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.Setup(c => c.GetSeries(seriesId, true, false))
.Returns(tvdbSeries);
Mocker.GetMock<SeasonRepository>()
Mocker.GetMock<ISeasonRepository>()
.Setup(s => s.IsIgnored(seriesId, It.IsAny<int>()))
.Returns(true);
@ -977,7 +977,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
.With(e => e.Ignored = false)
.Build();
Mocker.GetMock<SeasonRepository>()
Mocker.GetMock<ISeasonRepository>()
.Setup(s => s.IsIgnored(newEpisode.SeriesId, newEpisode.SeasonNumber))
.Returns(true);

@ -1,7 +1,6 @@
using System.Linq;
using NLog;
using NzbDrone.Core.History;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
@ -9,14 +8,12 @@ namespace NzbDrone.Core.DecisionEngine
{
public class UpgradeHistorySpecification
{
private readonly IEpisodeService _episodeService;
private readonly HistoryService _historyService;
private readonly IHistoryService _historyService;
private readonly QualityUpgradeSpecification _qualityUpgradeSpecification;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public UpgradeHistorySpecification(IEpisodeService episodeService, HistoryService historyService, QualityUpgradeSpecification qualityUpgradeSpecification)
public UpgradeHistorySpecification(IHistoryService historyService, QualityUpgradeSpecification qualityUpgradeSpecification)
{
_episodeService = episodeService;
_historyService = historyService;
_qualityUpgradeSpecification = qualityUpgradeSpecification;
}

@ -47,7 +47,7 @@ namespace NzbDrone.Core.Tv
{
get
{
if (EpisodeFileId != 0) return EpisodeStatusType.Ready;
if (HasFile) return EpisodeStatusType.Ready;
if (GrabDate != null)
{

@ -42,9 +42,9 @@ namespace NzbDrone.Core.Tv
private readonly TvDbProvider _tvDbProvider;
private readonly ISeasonRepository _seasonRepository;
private readonly EpisodeRepository _episodeRepository;
private readonly IEpisodeRepository _episodeRepository;
public EpisodeService(TvDbProvider tvDbProviderProvider, ISeasonRepository seasonRepository, EpisodeRepository episodeRepository)
public EpisodeService(TvDbProvider tvDbProviderProvider, ISeasonRepository seasonRepository, IEpisodeRepository episodeRepository)
{
_tvDbProvider = tvDbProviderProvider;
_seasonRepository = seasonRepository;

@ -36,7 +36,7 @@ namespace NzbDrone.Core.Tv
private readonly SceneMappingProvider _sceneNameMappingProvider;
public SeriesService(ISeriesRepository seriesRepository, ConfigService configServiceService,
public SeriesService(ISeriesRepository seriesRepository, IConfigService configServiceService,
TvDbProvider tvDbProviderProvider, SceneMappingProvider sceneNameMappingProvider, MetadataProvider metadataProvider,
TvRageMappingProvider tvRageMappingProvider, IEventAggregator eventAggregator)
{

Loading…
Cancel
Save