mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-19 21:46:50 -04:00
Quality moved to ObjectDb.
This commit is contained in:
@@ -7,12 +7,12 @@ using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
@@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
private EpisodeParseResult parseResultSingle;
|
||||
private Series series30minutes;
|
||||
private Series series60minutes;
|
||||
private QualityType qualityType;
|
||||
private QualitySize qualityType;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
SeriesTitle = "Title",
|
||||
Language = LanguageType.English,
|
||||
Quality = new QualityModel(QualityTypes.SDTV, true),
|
||||
Quality = new QualityModel(Quality.SDTV, true),
|
||||
EpisodeNumbers = new List<int> { 3, 4 },
|
||||
SeasonNumber = 12,
|
||||
AirDate = DateTime.Now.AddDays(-12).Date
|
||||
@@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
SeriesTitle = "Title",
|
||||
Language = LanguageType.English,
|
||||
Quality = new QualityModel(QualityTypes.SDTV, true),
|
||||
Quality = new QualityModel(Quality.SDTV, true),
|
||||
EpisodeNumbers = new List<int> { 3 },
|
||||
SeasonNumber = 12,
|
||||
AirDate = DateTime.Now.AddDays(-12).Date
|
||||
@@ -62,10 +62,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
.With(c => c.Runtime = 60)
|
||||
.Build();
|
||||
|
||||
qualityType = Builder<QualityType>.CreateNew()
|
||||
qualityType = Builder<QualitySize>.CreateNew()
|
||||
.With(q => q.MinSize = 0)
|
||||
.With(q => q.MaxSize = 10)
|
||||
.With(q => q.QualityTypeId = 1)
|
||||
.With(q => q.QualityId = 1)
|
||||
.Build();
|
||||
|
||||
}
|
||||
@@ -78,7 +78,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultSingle.Series = series30minutes;
|
||||
parseResultSingle.Size = 184572800;
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -99,7 +99,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultSingle.Series = series60minutes;
|
||||
parseResultSingle.Size = 368572800;
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -120,7 +120,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultSingle.Series = series30minutes;
|
||||
parseResultSingle.Size = 1.Gigabytes();
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -141,7 +141,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultSingle.Series = series60minutes;
|
||||
parseResultSingle.Size = 1.Gigabytes();
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -162,7 +162,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultMulti.Series = series30minutes;
|
||||
parseResultMulti.Size = 184572800;
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -183,7 +183,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultMulti.Series = series60minutes;
|
||||
parseResultMulti.Size = 368572800;
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -204,7 +204,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultMulti.Series = series30minutes;
|
||||
parseResultMulti.Size = 1.Gigabytes();
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -225,7 +225,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultMulti.Series = series60minutes;
|
||||
parseResultMulti.Size = 10.Gigabytes();
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -246,7 +246,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultSingle.Series = series30minutes;
|
||||
parseResultSingle.Size = 184572800;
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -267,7 +267,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultSingle.Series = series60minutes;
|
||||
parseResultSingle.Size = 368572800;
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -288,7 +288,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultSingle.Series = series30minutes;
|
||||
parseResultSingle.Size = 1.Gigabytes();
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -309,7 +309,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultSingle.Series = series60minutes;
|
||||
parseResultSingle.Size = 10.Gigabytes();
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -331,7 +331,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultSingle.Size = 18457280000;
|
||||
qualityType.MaxSize = 0;
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -353,7 +353,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultSingle.Size = 36857280000;
|
||||
qualityType.MaxSize = 0;
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -376,7 +376,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
|
||||
qualityType.MaxSize = (int)600.Megabytes();
|
||||
|
||||
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(
|
||||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
@@ -394,7 +394,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
var parseResult = new EpisodeParseResult
|
||||
{
|
||||
Quality = new QualityModel(QualityTypes.RAWHD, false)
|
||||
Quality = new QualityModel(Quality.RAWHD, false)
|
||||
};
|
||||
|
||||
Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
||||
|
||||
@@ -11,7 +11,6 @@ using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
|
||||
@@ -8,13 +8,13 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
@@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
SeriesTitle = "Title",
|
||||
Language = LanguageType.English,
|
||||
Quality = new QualityModel(QualityTypes.SDTV, true),
|
||||
Quality = new QualityModel(Quality.SDTV, true),
|
||||
EpisodeNumbers = new List<int> { 3 },
|
||||
SeasonNumber = 12,
|
||||
AirDate = DateTime.Now.AddDays(-12).Date,
|
||||
|
||||
+13
-13
@@ -5,11 +5,11 @@ using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
@@ -23,16 +23,16 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
|
||||
public static object[] AllowedTestCases =
|
||||
{
|
||||
new object[] { QualityTypes.DVD },
|
||||
new object[] { QualityTypes.HDTV720p },
|
||||
new object[] { QualityTypes.Bluray1080p }
|
||||
new object[] { Quality.DVD },
|
||||
new object[] { Quality.HDTV720p },
|
||||
new object[] { Quality.Bluray1080p }
|
||||
};
|
||||
|
||||
public static object[] DeniedTestCases =
|
||||
{
|
||||
new object[] { QualityTypes.SDTV },
|
||||
new object[] { QualityTypes.WEBDL720p },
|
||||
new object[] { QualityTypes.Bluray720p }
|
||||
new object[] { Quality.SDTV },
|
||||
new object[] { Quality.WEBDL720p },
|
||||
new object[] { Quality.Bluray720p }
|
||||
};
|
||||
|
||||
[SetUp]
|
||||
@@ -41,32 +41,32 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
_qualityAllowedByProfile = Mocker.Resolve<QualityAllowedByProfileSpecification>();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(c => c.QualityProfile = new QualityProfile { Cutoff = QualityTypes.Bluray1080p })
|
||||
.With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p })
|
||||
.Build();
|
||||
|
||||
parseResult = new EpisodeParseResult
|
||||
{
|
||||
Series = fakeSeries,
|
||||
Quality = new QualityModel(QualityTypes.DVD, true),
|
||||
Quality = new QualityModel(Quality.DVD, true),
|
||||
EpisodeNumbers = new List<int> { 3 },
|
||||
SeasonNumber = 12,
|
||||
};
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("AllowedTestCases")]
|
||||
public void should_allow_if_quality_is_defined_in_profile(QualityTypes qualityType)
|
||||
public void should_allow_if_quality_is_defined_in_profile(Quality qualityType)
|
||||
{
|
||||
parseResult.Quality.Quality = qualityType;
|
||||
parseResult.Series.QualityProfile.Allowed = new List<QualityTypes> { QualityTypes.DVD, QualityTypes.HDTV720p, QualityTypes.Bluray1080p };
|
||||
parseResult.Series.QualityProfile.Allowed = new List<Quality> { Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p };
|
||||
|
||||
_qualityAllowedByProfile.IsSatisfiedBy(parseResult).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("DeniedTestCases")]
|
||||
public void should_not_allow_if_quality_is_not_defined_in_profile(QualityTypes qualityType)
|
||||
public void should_not_allow_if_quality_is_not_defined_in_profile(Quality qualityType)
|
||||
{
|
||||
parseResult.Quality.Quality = qualityType;
|
||||
parseResult.Series.QualityProfile.Allowed = new List<QualityTypes> { QualityTypes.DVD, QualityTypes.HDTV720p, QualityTypes.Bluray1080p };
|
||||
parseResult.Series.QualityProfile.Allowed = new List<Quality> { Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p };
|
||||
|
||||
_qualityAllowedByProfile.IsSatisfiedBy(parseResult).Should().BeFalse();
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
@@ -17,19 +17,19 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
public static object[] IsUpgradeTestCases =
|
||||
{
|
||||
new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, true, QualityTypes.SDTV, true },
|
||||
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, true, QualityTypes.WEBDL720p, true },
|
||||
new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, false, QualityTypes.SDTV, false },
|
||||
new object[] { QualityTypes.SDTV, false, QualityTypes.DVD, true, QualityTypes.SDTV, false },
|
||||
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV720p, true, QualityTypes.Bluray720p, false },
|
||||
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV720p, true, QualityTypes.WEBDL720p, false },
|
||||
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, false },
|
||||
new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, true, QualityTypes.SDTV, true },
|
||||
new object[] { QualityTypes.WEBDL1080p, false, QualityTypes.WEBDL1080p, false, QualityTypes.WEBDL1080p, false }
|
||||
new object[] { Quality.SDTV, false, Quality.SDTV, true, Quality.SDTV, true },
|
||||
new object[] { Quality.WEBDL720p, false, Quality.WEBDL720p, true, Quality.WEBDL720p, true },
|
||||
new object[] { Quality.SDTV, false, Quality.SDTV, false, Quality.SDTV, false },
|
||||
new object[] { Quality.SDTV, false, Quality.DVD, true, Quality.SDTV, false },
|
||||
new object[] { Quality.WEBDL720p, false, Quality.HDTV720p, true, Quality.Bluray720p, false },
|
||||
new object[] { Quality.WEBDL720p, false, Quality.HDTV720p, true, Quality.WEBDL720p, false },
|
||||
new object[] { Quality.WEBDL720p, false, Quality.WEBDL720p, false, Quality.WEBDL720p, false },
|
||||
new object[] { Quality.SDTV, false, Quality.SDTV, true, Quality.SDTV, true },
|
||||
new object[] { Quality.WEBDL1080p, false, Quality.WEBDL1080p, false, Quality.WEBDL1080p, false }
|
||||
};
|
||||
|
||||
[Test, TestCaseSource("IsUpgradeTestCases")]
|
||||
public void IsUpgradeTest(QualityTypes current, bool currentProper, QualityTypes newQuality, bool newProper, QualityTypes cutoff, bool expected)
|
||||
public void IsUpgradeTest(Quality current, bool currentProper, Quality newQuality, bool newProper, Quality cutoff, bool expected)
|
||||
{
|
||||
new QualityUpgradeSpecification().IsSatisfiedBy(new QualityModel(current, currentProper), new QualityModel(newQuality, newProper), cutoff)
|
||||
.Should().Be(expected);
|
||||
|
||||
@@ -6,12 +6,12 @@ using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
@@ -33,20 +33,20 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
Mocker.Resolve<QualityUpgradeSpecification>();
|
||||
_upgradeDisk = Mocker.Resolve<UpgradeDiskSpecification>();
|
||||
|
||||
firstFile = new EpisodeFile { Quality = QualityTypes.Bluray1080p, Proper = true, DateAdded = DateTime.Now };
|
||||
secondFile = new EpisodeFile { Quality = QualityTypes.Bluray1080p, Proper = true, DateAdded = DateTime.Now };
|
||||
firstFile = new EpisodeFile { Quality = Quality.Bluray1080p, Proper = true, DateAdded = DateTime.Now };
|
||||
secondFile = new EpisodeFile { Quality = Quality.Bluray1080p, Proper = true, DateAdded = DateTime.Now };
|
||||
|
||||
var singleEpisodeList = new List<Episode> { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = null } };
|
||||
var doubleEpisodeList = new List<Episode> { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = secondFile }, new Episode { EpisodeFile = null } };
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(c => c.QualityProfile = new QualityProfile { Cutoff = QualityTypes.Bluray1080p })
|
||||
.With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p })
|
||||
.Build();
|
||||
|
||||
parseResultMulti = new EpisodeParseResult
|
||||
{
|
||||
Series = fakeSeries,
|
||||
Quality = new QualityModel(QualityTypes.DVD, true),
|
||||
Quality = new QualityModel(Quality.DVD, true),
|
||||
EpisodeNumbers = new List<int> { 3, 4 },
|
||||
SeasonNumber = 12,
|
||||
Episodes = doubleEpisodeList
|
||||
@@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultSingle = new EpisodeParseResult
|
||||
{
|
||||
Series = fakeSeries,
|
||||
Quality = new QualityModel(QualityTypes.DVD, true),
|
||||
Quality = new QualityModel(Quality.DVD, true),
|
||||
EpisodeNumbers = new List<int> { 3 },
|
||||
SeasonNumber = 12,
|
||||
Episodes = singleEpisodeList
|
||||
@@ -64,12 +64,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
|
||||
private void WithFirstFileUpgradable()
|
||||
{
|
||||
firstFile.Quality = QualityTypes.SDTV;
|
||||
firstFile.Quality = Quality.SDTV;
|
||||
}
|
||||
|
||||
private void WithSecondFileUpgradable()
|
||||
{
|
||||
secondFile.Quality = QualityTypes.SDTV;
|
||||
secondFile.Quality = Quality.SDTV;
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -118,9 +118,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
[Test]
|
||||
public void should_not_be_upgradable_if_qualities_are_the_same()
|
||||
{
|
||||
firstFile.Quality = QualityTypes.WEBDL1080p;
|
||||
firstFile.Quality = Quality.WEBDL1080p;
|
||||
firstFile.Proper = false;
|
||||
parseResultSingle.Quality = new QualityModel(QualityTypes.WEBDL1080p, false);
|
||||
parseResultSingle.Quality = new QualityModel(Quality.WEBDL1080p, false);
|
||||
_upgradeDisk.IsSatisfiedBy(parseResultSingle).Should().BeFalse();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
@@ -42,13 +42,13 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
};
|
||||
|
||||
fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(c => c.QualityProfile = new QualityProfile { Cutoff = QualityTypes.Bluray1080p })
|
||||
.With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p })
|
||||
.Build();
|
||||
|
||||
parseResultMulti = new EpisodeParseResult
|
||||
{
|
||||
Series = fakeSeries,
|
||||
Quality = new QualityModel(QualityTypes.DVD, true),
|
||||
Quality = new QualityModel(Quality.DVD, true),
|
||||
EpisodeNumbers = new List<int> { 3, 4 },
|
||||
SeasonNumber = 12,
|
||||
Episodes = doubleEpisodeList
|
||||
@@ -57,14 +57,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultSingle = new EpisodeParseResult
|
||||
{
|
||||
Series = fakeSeries,
|
||||
Quality = new QualityModel(QualityTypes.DVD, true),
|
||||
Quality = new QualityModel(Quality.DVD, true),
|
||||
EpisodeNumbers = new List<int> { 3 },
|
||||
SeasonNumber = 12,
|
||||
Episodes = singleEpisodeList
|
||||
};
|
||||
|
||||
firstQuality = new QualityModel(QualityTypes.Bluray1080p, true);
|
||||
secondQuality = new QualityModel(QualityTypes.Bluray1080p, true);
|
||||
firstQuality = new QualityModel(Quality.Bluray1080p, true);
|
||||
secondQuality = new QualityModel(Quality.Bluray1080p, true);
|
||||
|
||||
Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 3)).Returns(firstQuality);
|
||||
Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 4)).Returns(secondQuality);
|
||||
@@ -73,12 +73,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
|
||||
private void WithFirstReportUpgradable()
|
||||
{
|
||||
firstQuality.Quality = QualityTypes.SDTV;
|
||||
firstQuality.Quality = Quality.SDTV;
|
||||
}
|
||||
|
||||
private void WithSecondReportUpgradable()
|
||||
{
|
||||
secondQuality.Quality = QualityTypes.SDTV;
|
||||
secondQuality.Quality = Quality.SDTV;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,9 +120,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
[Test]
|
||||
public void should_not_be_upgradable_if_episode_is_of_same_quality_as_existing()
|
||||
{
|
||||
fakeSeries.QualityProfile = new QualityProfile { Cutoff = QualityTypes.WEBDL1080p };
|
||||
parseResultSingle.Quality = new QualityModel(QualityTypes.WEBDL1080p, false);
|
||||
firstQuality = new QualityModel(QualityTypes.WEBDL1080p, false);
|
||||
fakeSeries.QualityProfile = new QualityProfile { Cutoff = Quality.WEBDL1080p };
|
||||
parseResultSingle.Quality = new QualityModel(Quality.WEBDL1080p, false);
|
||||
firstQuality = new QualityModel(Quality.WEBDL1080p, false);
|
||||
|
||||
Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 3)).Returns(firstQuality);
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
@@ -20,8 +20,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
private void WithWebdlCutoff()
|
||||
{
|
||||
var profile = new QualityProfile { Cutoff = QualityTypes.WEBDL720p };
|
||||
Mocker.GetMock<QualityProvider>().Setup(s => s.Get(It.IsAny<int>())).Returns(profile);
|
||||
var profile = new QualityProfile { Cutoff = Quality.WEBDL720p };
|
||||
Mocker.GetMock<QualityProfileService>().Setup(s => s.Get(It.IsAny<int>())).Returns(profile);
|
||||
}
|
||||
|
||||
private Series _series;
|
||||
@@ -35,7 +35,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
.Build();
|
||||
|
||||
_episodeFile = Builder<EpisodeFile>.CreateNew()
|
||||
.With(f => f.Quality = QualityTypes.SDTV)
|
||||
.With(f => f.Quality = Quality.SDTV)
|
||||
.Build();
|
||||
|
||||
_episode = Builder<Episode>.CreateNew()
|
||||
@@ -76,7 +76,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
WithWebdlCutoff();
|
||||
|
||||
_episodeFile.Quality = QualityTypes.WEBDL720p;
|
||||
_episodeFile.Quality = Quality.WEBDL720p;
|
||||
|
||||
//Act
|
||||
bool result = Mocker.Resolve<UpgradePossibleSpecification>().IsSatisfiedBy(_episode);
|
||||
@@ -90,7 +90,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
WithWebdlCutoff();
|
||||
|
||||
_episodeFile.Quality = QualityTypes.Bluray720p;
|
||||
_episodeFile.Quality = Quality.Bluray720p;
|
||||
|
||||
//Act
|
||||
bool result = Mocker.Resolve<UpgradePossibleSpecification>().IsSatisfiedBy(_episode);
|
||||
|
||||
Reference in New Issue
Block a user