mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Namespace for CustomFormats Tests
This commit is contained in:
@@ -1,17 +1,18 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.CustomFormat
|
namespace NzbDrone.Core.Test.CustomFormats
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class CustomFormatsFixture : CoreTest
|
public class CustomFormatsFixture : CoreTest
|
||||||
{
|
{
|
||||||
private static List<CustomFormats.CustomFormat> _customFormats { get; set; }
|
private static List<CustomFormat> _customFormats { get; set; }
|
||||||
|
|
||||||
public static void GivenCustomFormats(params CustomFormats.CustomFormat[] formats)
|
public static void GivenCustomFormats(params CustomFormat[] formats)
|
||||||
{
|
{
|
||||||
_customFormats = formats.ToList();
|
_customFormats = formats.ToList();
|
||||||
}
|
}
|
||||||
@@ -28,7 +29,7 @@ namespace NzbDrone.Core.Test.CustomFormat
|
|||||||
new ProfileFormatItem
|
new ProfileFormatItem
|
||||||
{
|
{
|
||||||
Allowed = true,
|
Allowed = true,
|
||||||
Format = CustomFormats.CustomFormat.None
|
Format = CustomFormat.None
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
@@ -5,7 +5,7 @@ using NzbDrone.Core.CustomFormats;
|
|||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.CustomFormat
|
namespace NzbDrone.Core.Test.CustomFormats
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class QualityTagFixture : CoreTest
|
public class QualityTagFixture : CoreTest
|
@@ -2,12 +2,13 @@ using System.Collections.Generic;
|
|||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.CustomFormat;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
@@ -18,16 +19,16 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||||||
{
|
{
|
||||||
private RemoteMovie _remoteMovie;
|
private RemoteMovie _remoteMovie;
|
||||||
|
|
||||||
private CustomFormats.CustomFormat _format1;
|
private CustomFormat _format1;
|
||||||
private CustomFormats.CustomFormat _format2;
|
private CustomFormat _format2;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_format1 = new CustomFormats.CustomFormat("Awesome Format");
|
_format1 = new CustomFormat("Awesome Format");
|
||||||
_format1.Id = 1;
|
_format1.Id = 1;
|
||||||
|
|
||||||
_format2 = new CustomFormats.CustomFormat("Cool Format");
|
_format2 = new CustomFormat("Cool Format");
|
||||||
_format2.Id = 2;
|
_format2.Id = 2;
|
||||||
|
|
||||||
var fakeSeries = Builder<Movie>.CreateNew()
|
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)) },
|
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]
|
[Test]
|
||||||
public void should_allow_if_format_is_defined_in_profile()
|
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);
|
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(_format1.Name);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
||||||
@@ -55,7 +56,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_deny_if_format_is_defined_in_profile()
|
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);
|
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(_format1.Name);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
||||||
@@ -64,7 +65,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_deny_if_one_format_is_defined_in_profile()
|
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);
|
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(_format1.Name);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
||||||
@@ -73,7 +74,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_allow_if_all_format_is_defined_in_profile()
|
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);
|
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(_format1.Name, _format2.Name);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
||||||
@@ -82,7 +83,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_deny_if_no_format_was_parsed_and_none_not_in_profile()
|
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);
|
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(_format1.Name, _format2.Name);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
||||||
@@ -91,8 +92,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_allow_if_no_format_was_parsed_and_none_in_profile()
|
public void should_allow_if_no_format_was_parsed_and_none_in_profile()
|
||||||
{
|
{
|
||||||
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormats.CustomFormat> { };
|
_remoteMovie.ParsedMovieInfo.Quality.CustomFormats = new List<CustomFormat> { };
|
||||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(CustomFormats.CustomFormat.None.Name, _format1.Name, _format2.Name);
|
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsFixture.GetSampleFormatItems(CustomFormat.None.Name, _format1.Name, _format2.Name);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.CustomFormat;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
@@ -12,7 +13,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class CutoffSpecificationFixture : CoreTest<UpgradableSpecification>
|
public class CutoffSpecificationFixture : CoreTest<UpgradableSpecification>
|
||||||
{
|
{
|
||||||
private CustomFormats.CustomFormat _customFormat;
|
private CustomFormat _customFormat;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
@@ -21,9 +22,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||||||
|
|
||||||
private void GivenCustomFormatHigher()
|
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]
|
[Test]
|
||||||
@@ -68,15 +69,15 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||||||
{
|
{
|
||||||
GivenCustomFormatHigher();
|
GivenCustomFormatHigher();
|
||||||
var old = new QualityModel(Quality.HDTV720p);
|
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);
|
var newQ = new QualityModel(Quality.Bluray1080p);
|
||||||
newQ.CustomFormats = new List<CustomFormats.CustomFormat> { _customFormat };
|
newQ.CustomFormats = new List<CustomFormat> { _customFormat };
|
||||||
Subject.CutoffNotMet(
|
Subject.CutoffNotMet(
|
||||||
new Profile
|
new Profile
|
||||||
{
|
{
|
||||||
Cutoff = Quality.HDTV720p.Id,
|
Cutoff = Quality.HDTV720p.Id,
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
FormatCutoff = CustomFormats.CustomFormat.None.Id,
|
FormatCutoff = CustomFormat.None.Id,
|
||||||
FormatItems = CustomFormatsFixture.GetSampleFormatItems("None", "My Format")
|
FormatItems = CustomFormatsFixture.GetSampleFormatItems("None", "My Format")
|
||||||
},
|
},
|
||||||
old,
|
old,
|
||||||
|
@@ -6,6 +6,7 @@ using FluentAssertions;
|
|||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
@@ -13,7 +14,7 @@ using NzbDrone.Core.Parser.Model;
|
|||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
using NzbDrone.Core.Profiles.Delay;
|
using NzbDrone.Core.Profiles.Delay;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.CustomFormat;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
@@ -23,18 +24,18 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||||||
//TODO: Update for custom qualities!
|
//TODO: Update for custom qualities!
|
||||||
public class PrioritizeDownloadDecisionFixture : CoreTest<DownloadDecisionPriorizationService>
|
public class PrioritizeDownloadDecisionFixture : CoreTest<DownloadDecisionPriorizationService>
|
||||||
{
|
{
|
||||||
private CustomFormats.CustomFormat _customFormat1;
|
private CustomFormat _customFormat1;
|
||||||
private CustomFormats.CustomFormat _customFormat2;
|
private CustomFormat _customFormat2;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
GivenPreferredDownloadProtocol(DownloadProtocol.Usenet);
|
GivenPreferredDownloadProtocol(DownloadProtocol.Usenet);
|
||||||
|
|
||||||
_customFormat1 = new CustomFormats.CustomFormat("My Format 1", "L_ENGLISH") { Id = 1 };
|
_customFormat1 = new CustomFormat("My Format 1", "L_ENGLISH") { Id = 1 };
|
||||||
_customFormat2 = new CustomFormats.CustomFormat("My Format 2", "L_FRENCH") { Id = 2 };
|
_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)
|
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()
|
public void should_prefer_better_custom_format()
|
||||||
{
|
{
|
||||||
var quality1 = new QualityModel(Quality.Bluray720p);
|
var quality1 = new QualityModel(Quality.Bluray720p);
|
||||||
quality1.CustomFormats.Add(CustomFormats.CustomFormat.None);
|
quality1.CustomFormats.Add(CustomFormat.None);
|
||||||
var remoteMovie1 = GivenRemoteMovie(quality1);
|
var remoteMovie1 = GivenRemoteMovie(quality1);
|
||||||
|
|
||||||
var quality2 = new QualityModel(Quality.Bluray720p);
|
var quality2 = new QualityModel(Quality.Bluray720p);
|
||||||
@@ -365,7 +366,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||||||
var remoteMovie1 = GivenRemoteMovie(quality1);
|
var remoteMovie1 = GivenRemoteMovie(quality1);
|
||||||
|
|
||||||
var quality2 = new QualityModel(Quality.Bluray720p);
|
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 remoteMovie2 = GivenRemoteMovie(quality2);
|
||||||
|
|
||||||
var decisions = new List<DownloadDecision>();
|
var decisions = new List<DownloadDecision>();
|
||||||
|
@@ -31,10 +31,10 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators
|
|||||||
.Returns(AugmentQualityResult.ResolutionOnly((int)Resolution.R1080p, Confidence.MediaInfo));
|
.Returns(AugmentQualityResult.ResolutionOnly((int)Resolution.R1080p, Confidence.MediaInfo));
|
||||||
|
|
||||||
_fileExtensionAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>()))
|
_fileExtensionAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>()))
|
||||||
.Returns(new AugmentQualityResult(Source.TV, Confidence.Fallback, (int)Resolution.R720p, Confidence.Fallback, Modifier.NONE, Confidence.Fallback, new Revision(), new List<CustomFormats.CustomFormat>()));
|
.Returns(new AugmentQualityResult(Source.TV, Confidence.Fallback, (int)Resolution.R720p, Confidence.Fallback, Modifier.NONE, Confidence.Fallback, new Revision(), new List<CustomFormat>()));
|
||||||
|
|
||||||
_nameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>()))
|
_nameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>()))
|
||||||
.Returns(new AugmentQualityResult(Source.TV, Confidence.Default, (int)Resolution.R480p, Confidence.Default, Modifier.NONE, Confidence.Default, new Revision(), new List<CustomFormats.CustomFormat>()));
|
.Returns(new AugmentQualityResult(Source.TV, Confidence.Default, (int)Resolution.R480p, Confidence.Default, Modifier.NONE, Confidence.Default, new Revision(), new List<CustomFormat>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GivenAugmenters(params Mock<IAugmentQuality>[] mocks)
|
private void GivenAugmenters(params Mock<IAugmentQuality>[] mocks)
|
||||||
|
@@ -3,6 +3,7 @@ using FizzWare.NBuilder;
|
|||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.History;
|
using NzbDrone.Core.History;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
using NzbDrone.Core.MediaFiles.Commands;
|
using NzbDrone.Core.MediaFiles.Commands;
|
||||||
@@ -33,9 +34,9 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|||||||
_movieFile.Quality = _oldQuality;
|
_movieFile.Quality = _oldQuality;
|
||||||
|
|
||||||
_newQuality = _oldQuality.JsonClone();
|
_newQuality = _oldQuality.JsonClone();
|
||||||
var format = new CustomFormats.CustomFormat("Awesome Format");
|
var format = new CustomFormat("Awesome Format");
|
||||||
format.Id = 1;
|
format.Id = 1;
|
||||||
_newQuality.CustomFormats = new List<CustomFormats.CustomFormat> { format };
|
_newQuality.CustomFormats = new List<CustomFormat> { format };
|
||||||
|
|
||||||
_newInfo = new ParsedMovieInfo
|
_newInfo = new ParsedMovieInfo
|
||||||
{
|
{
|
||||||
|
@@ -2,9 +2,11 @@ using System.Linq;
|
|||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.MovieTests.MovieRepositoryTests
|
namespace NzbDrone.Core.Test.MovieTests.MovieRepositoryTests
|
||||||
@@ -28,8 +30,8 @@ namespace NzbDrone.Core.Test.MovieTests.MovieRepositoryTests
|
|||||||
var profile = new Profile
|
var profile = new Profile
|
||||||
{
|
{
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.Bluray1080p, Quality.DVD, Quality.HDTV720p),
|
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.Bluray1080p, Quality.DVD, Quality.HDTV720p),
|
||||||
FormatItems = CustomFormat.CustomFormatsFixture.GetDefaultFormatItems(),
|
FormatItems = CustomFormatsFixture.GetDefaultFormatItems(),
|
||||||
FormatCutoff = CustomFormats.CustomFormat.None.Id,
|
FormatCutoff = CustomFormat.None.Id,
|
||||||
Cutoff = Quality.Bluray1080p.Id,
|
Cutoff = Quality.Bluray1080p.Id,
|
||||||
Name = "TestProfile"
|
Name = "TestProfile"
|
||||||
};
|
};
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.Languages;
|
using NzbDrone.Core.Languages;
|
||||||
using NzbDrone.Core.Parser.Augmenters;
|
using NzbDrone.Core.Parser.Augmenters;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
@@ -68,22 +69,22 @@ namespace NzbDrone.Core.Test.ParserTests.ParsingServiceTests.AugmentersTests
|
|||||||
Quality = new QualityModel(Quality.Bluray1080p)
|
Quality = new QualityModel(Quality.Bluray1080p)
|
||||||
};
|
};
|
||||||
|
|
||||||
var format1 = new CustomFormats.CustomFormat("Awesome Format");
|
var format1 = new CustomFormat("Awesome Format");
|
||||||
format1.Id = 1;
|
format1.Id = 1;
|
||||||
|
|
||||||
var format2 = new CustomFormats.CustomFormat("Cool Format");
|
var format2 = new CustomFormat("Cool Format");
|
||||||
format2.Id = 2;
|
format2.Id = 2;
|
||||||
|
|
||||||
folderInfo.Quality.CustomFormats = new List<CustomFormats.CustomFormat> { format1 };
|
folderInfo.Quality.CustomFormats = new List<CustomFormat> { format1 };
|
||||||
|
|
||||||
MovieInfo.Quality.CustomFormats = new List<CustomFormats.CustomFormat> { format2 };
|
MovieInfo.Quality.CustomFormats = new List<CustomFormat> { format2 };
|
||||||
|
|
||||||
var result = Subject.AugmentMovieInfo(MovieInfo, folderInfo);
|
var result = Subject.AugmentMovieInfo(MovieInfo, folderInfo);
|
||||||
|
|
||||||
result.Quality.CustomFormats.Count.Should().Be(2);
|
result.Quality.CustomFormats.Count.Should().Be(2);
|
||||||
result.Quality.CustomFormats.Should().BeEquivalentTo(format2, format1);
|
result.Quality.CustomFormats.Should().BeEquivalentTo(format2, format1);
|
||||||
|
|
||||||
folderInfo.Quality.CustomFormats = new List<CustomFormats.CustomFormat> { format1, format2 };
|
folderInfo.Quality.CustomFormats = new List<CustomFormat> { format1, format2 };
|
||||||
|
|
||||||
result = Subject.AugmentMovieInfo(MovieInfo, folderInfo);
|
result = Subject.AugmentMovieInfo(MovieInfo, folderInfo);
|
||||||
|
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.Profiles
|
namespace NzbDrone.Core.Test.Profiles
|
||||||
@@ -20,8 +22,8 @@ namespace NzbDrone.Core.Test.Profiles
|
|||||||
var profile = new Profile
|
var profile = new Profile
|
||||||
{
|
{
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.Bluray1080p, Quality.DVD, Quality.HDTV720p),
|
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.Bluray1080p, Quality.DVD, Quality.HDTV720p),
|
||||||
FormatCutoff = CustomFormats.CustomFormat.None.Id,
|
FormatCutoff = CustomFormat.None.Id,
|
||||||
FormatItems = CustomFormat.CustomFormatsFixture.GetDefaultFormatItems(),
|
FormatItems = CustomFormatsFixture.GetDefaultFormatItems(),
|
||||||
Cutoff = Quality.Bluray1080p.Id,
|
Cutoff = Quality.Bluray1080p.Id,
|
||||||
Name = "TestProfile"
|
Name = "TestProfile"
|
||||||
};
|
};
|
||||||
|
@@ -21,7 +21,7 @@ namespace NzbDrone.Core.Test.Profiles
|
|||||||
{
|
{
|
||||||
Mocker.GetMock<ICustomFormatService>()
|
Mocker.GetMock<ICustomFormatService>()
|
||||||
.Setup(s => s.All())
|
.Setup(s => s.All())
|
||||||
.Returns(new List<CustomFormats.CustomFormat>());
|
.Returns(new List<CustomFormat>());
|
||||||
|
|
||||||
Subject.Handle(new ApplicationStartedEvent());
|
Subject.Handle(new ApplicationStartedEvent());
|
||||||
|
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.CustomFormat;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.Qualities
|
namespace NzbDrone.Core.Test.Qualities
|
||||||
@@ -13,8 +14,8 @@ namespace NzbDrone.Core.Test.Qualities
|
|||||||
{
|
{
|
||||||
public QualityModelComparer Subject { get; set; }
|
public QualityModelComparer Subject { get; set; }
|
||||||
|
|
||||||
private CustomFormats.CustomFormat _customFormat1;
|
private CustomFormat _customFormat1;
|
||||||
private CustomFormats.CustomFormat _customFormat2;
|
private CustomFormat _customFormat2;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
@@ -77,10 +78,10 @@ namespace NzbDrone.Core.Test.Qualities
|
|||||||
|
|
||||||
private void GivenDefaultProfileWithFormats()
|
private void GivenDefaultProfileWithFormats()
|
||||||
{
|
{
|
||||||
_customFormat1 = new CustomFormats.CustomFormat("My Format 1", "L_ENGLISH") { Id = 1 };
|
_customFormat1 = new CustomFormat("My Format 1", "L_ENGLISH") { Id = 1 };
|
||||||
_customFormat2 = new CustomFormats.CustomFormat("My Format 2", "L_FRENCH") { Id = 2 };
|
_customFormat2 = new CustomFormat("My Format 2", "L_FRENCH") { Id = 2 };
|
||||||
|
|
||||||
CustomFormatsFixture.GivenCustomFormats(CustomFormats.CustomFormat.None, _customFormat1, _customFormat2);
|
CustomFormatsFixture.GivenCustomFormats(CustomFormat.None, _customFormat1, _customFormat2);
|
||||||
|
|
||||||
Subject = new QualityModelComparer(new Profile { Items = QualityFixture.GetDefaultQualities(), FormatItems = CustomFormatsFixture.GetSampleFormatItems() });
|
Subject = new QualityModelComparer(new Profile { Items = QualityFixture.GetDefaultQualities(), FormatItems = CustomFormatsFixture.GetSampleFormatItems() });
|
||||||
}
|
}
|
||||||
@@ -142,8 +143,8 @@ namespace NzbDrone.Core.Test.Qualities
|
|||||||
{
|
{
|
||||||
GivenDefaultProfileWithFormats();
|
GivenDefaultProfileWithFormats();
|
||||||
|
|
||||||
var first = new QualityModel(Quality.DVD) { CustomFormats = new List<CustomFormats.CustomFormat> { _customFormat1 } };
|
var first = new QualityModel(Quality.DVD) { CustomFormats = new List<CustomFormat> { _customFormat1 } };
|
||||||
var second = new QualityModel(Quality.DVD) { CustomFormats = new List<CustomFormats.CustomFormat> { _customFormat2 } };
|
var second = new QualityModel(Quality.DVD) { CustomFormats = new List<CustomFormat> { _customFormat2 } };
|
||||||
|
|
||||||
var compare = Subject.Compare(first, second);
|
var compare = Subject.Compare(first, second);
|
||||||
|
|
||||||
@@ -155,8 +156,8 @@ namespace NzbDrone.Core.Test.Qualities
|
|||||||
{
|
{
|
||||||
GivenDefaultProfileWithFormats();
|
GivenDefaultProfileWithFormats();
|
||||||
|
|
||||||
var first = new QualityModel(Quality.DVD) { CustomFormats = new List<CustomFormats.CustomFormat> { _customFormat2 } };
|
var first = new QualityModel(Quality.DVD) { CustomFormats = new List<CustomFormat> { _customFormat2 } };
|
||||||
var second = new QualityModel(Quality.DVD) { CustomFormats = new List<CustomFormats.CustomFormat> { _customFormat1 } };
|
var second = new QualityModel(Quality.DVD) { CustomFormats = new List<CustomFormat> { _customFormat1 } };
|
||||||
|
|
||||||
var compare = Subject.Compare(first, second);
|
var compare = Subject.Compare(first, second);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user