mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-25 22:37:27 -04:00
Fixed: Namespace for CustomFormats Tests
This commit is contained in:
+14
-13
@@ -2,12 +2,13 @@ using System.Collections.Generic;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.CustomFormat;
|
||||
using NzbDrone.Core.Test.CustomFormats;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
@@ -18,16 +19,16 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
private RemoteMovie _remoteMovie;
|
||||
|
||||
private CustomFormats.CustomFormat _format1;
|
||||
private CustomFormats.CustomFormat _format2;
|
||||
private CustomFormat _format1;
|
||||
private CustomFormat _format2;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_format1 = new CustomFormats.CustomFormat("Awesome Format");
|
||||
_format1 = new CustomFormat("Awesome Format");
|
||||
_format1.Id = 1;
|
||||
|
||||
_format2 = new CustomFormats.CustomFormat("Cool Format");
|
||||
_format2 = new CustomFormat("Cool Format");
|
||||
_format2.Id = 2;
|
||||
|
||||
var fakeSeries = Builder<Movie>.CreateNew()
|
||||
@@ -40,13 +41,13 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
ParsedMovieInfo = new ParsedMovieInfo { Quality = new QualityModel(Quality.DVD, new Revision(version: 2)) },
|
||||
};
|
||||
|
||||
CustomFormatsFixture.GivenCustomFormats(CustomFormats.CustomFormat.None, _format1, _format2);
|
||||
CustomFormatsFixture.GivenCustomFormats(CustomFormat.None, _format1, _format2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_allow_if_format_is_defined_in_profile()
|
||||
{
|
||||
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormats.CustomFormat> { _format1 };
|
||||
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormat> { _format1 };
|
||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(_format1.Name);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
||||
@@ -55,7 +56,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
[Test]
|
||||
public void should_deny_if_format_is_defined_in_profile()
|
||||
{
|
||||
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormats.CustomFormat> { _format2 };
|
||||
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormat> { _format2 };
|
||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(_format1.Name);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
||||
@@ -64,7 +65,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
[Test]
|
||||
public void should_deny_if_one_format_is_defined_in_profile()
|
||||
{
|
||||
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormats.CustomFormat> { _format2, _format1 };
|
||||
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormat> { _format2, _format1 };
|
||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(_format1.Name);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
||||
@@ -73,7 +74,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
[Test]
|
||||
public void should_allow_if_all_format_is_defined_in_profile()
|
||||
{
|
||||
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormats.CustomFormat> { _format2, _format1 };
|
||||
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormat> { _format2, _format1 };
|
||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(_format1.Name, _format2.Name);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
||||
@@ -82,7 +83,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
[Test]
|
||||
public void should_deny_if_no_format_was_parsed_and_none_not_in_profile()
|
||||
{
|
||||
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormats.CustomFormat> { };
|
||||
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormat> { };
|
||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(_format1.Name, _format2.Name);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
||||
@@ -91,8 +92,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
[Test]
|
||||
public void should_allow_if_no_format_was_parsed_and_none_in_profile()
|
||||
{
|
||||
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormats.CustomFormat> { };
|
||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(CustomFormats.CustomFormat.None.Name, _format1.Name, _format2.Name);
|
||||
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormat> { };
|
||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(CustomFormat.None.Name, _format1.Name, _format2.Name);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.CustomFormat;
|
||||
using NzbDrone.Core.Test.CustomFormats;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
@@ -12,7 +13,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
[TestFixture]
|
||||
public class CutoffSpecificationFixture : CoreTest<UpgradableSpecification>
|
||||
{
|
||||
private CustomFormats.CustomFormat _customFormat;
|
||||
private CustomFormat _customFormat;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@@ -21,9 +22,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
|
||||
private void GivenCustomFormatHigher()
|
||||
{
|
||||
_customFormat = new CustomFormats.CustomFormat("My Format", "L_ENGLISH") { Id = 1 };
|
||||
_customFormat = new CustomFormat("My Format", "L_ENGLISH") { Id = 1 };
|
||||
|
||||
CustomFormatsFixture.GivenCustomFormats(_customFormat, CustomFormats.CustomFormat.None);
|
||||
CustomFormatsFixture.GivenCustomFormats(_customFormat, CustomFormat.None);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -68,15 +69,15 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
GivenCustomFormatHigher();
|
||||
var old = new QualityModel(Quality.HDTV720p);
|
||||
old.CustomFormats = new List<CustomFormats.CustomFormat> { CustomFormats.CustomFormat.None };
|
||||
old.CustomFormats = new List<CustomFormat> { CustomFormat.None };
|
||||
var newQ = new QualityModel(Quality.Bluray1080p);
|
||||
newQ.CustomFormats = new List<CustomFormats.CustomFormat> { _customFormat };
|
||||
newQ.CustomFormats = new List<CustomFormat> { _customFormat };
|
||||
Subject.CutoffNotMet(
|
||||
new Profile
|
||||
{
|
||||
Cutoff = Quality.HDTV720p.Id,
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
FormatCutoff = CustomFormats.CustomFormat.None.Id,
|
||||
FormatCutoff = CustomFormat.None.Id,
|
||||
FormatItems = CustomFormatsFixture.GetSampleFormatItems("None", "My Format")
|
||||
},
|
||||
old,
|
||||
|
||||
@@ -6,6 +6,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Movies;
|
||||
@@ -13,7 +14,7 @@ using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using NzbDrone.Core.Profiles.Delay;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.CustomFormat;
|
||||
using NzbDrone.Core.Test.CustomFormats;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
@@ -23,18 +24,18 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
//TODO: Update for custom qualities!
|
||||
public class PrioritizeDownloadDecisionFixture : CoreTest<DownloadDecisionPriorizationService>
|
||||
{
|
||||
private CustomFormats.CustomFormat _customFormat1;
|
||||
private CustomFormats.CustomFormat _customFormat2;
|
||||
private CustomFormat _customFormat1;
|
||||
private CustomFormat _customFormat2;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
GivenPreferredDownloadProtocol(DownloadProtocol.Usenet);
|
||||
|
||||
_customFormat1 = new CustomFormats.CustomFormat("My Format 1", "L_ENGLISH") { Id = 1 };
|
||||
_customFormat2 = new CustomFormats.CustomFormat("My Format 2", "L_FRENCH") { Id = 2 };
|
||||
_customFormat1 = new CustomFormat("My Format 1", "L_ENGLISH") { Id = 1 };
|
||||
_customFormat2 = new CustomFormat("My Format 2", "L_FRENCH") { Id = 2 };
|
||||
|
||||
CustomFormatsFixture.GivenCustomFormats(CustomFormats.CustomFormat.None, _customFormat1, _customFormat2);
|
||||
CustomFormatsFixture.GivenCustomFormats(CustomFormat.None, _customFormat1, _customFormat2);
|
||||
}
|
||||
|
||||
private RemoteMovie GivenRemoteMovie(QualityModel quality, int age = 0, long size = 0, DownloadProtocol downloadProtocol = DownloadProtocol.Usenet)
|
||||
@@ -323,7 +324,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
public void should_prefer_better_custom_format()
|
||||
{
|
||||
var quality1 = new QualityModel(Quality.Bluray720p);
|
||||
quality1.CustomFormats.Add(CustomFormats.CustomFormat.None);
|
||||
quality1.CustomFormats.Add(CustomFormat.None);
|
||||
var remoteMovie1 = GivenRemoteMovie(quality1);
|
||||
|
||||
var quality2 = new QualityModel(Quality.Bluray720p);
|
||||
@@ -365,7 +366,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
var remoteMovie1 = GivenRemoteMovie(quality1);
|
||||
|
||||
var quality2 = new QualityModel(Quality.Bluray720p);
|
||||
quality2.CustomFormats.AddRange(new List<CustomFormats.CustomFormat> { _customFormat1, _customFormat2 });
|
||||
quality2.CustomFormats.AddRange(new List<CustomFormat> { _customFormat1, _customFormat2 });
|
||||
var remoteMovie2 = GivenRemoteMovie(quality2);
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
|
||||
Reference in New Issue
Block a user