|
|
@ -16,6 +16,8 @@ namespace NzbDrone.Core.Test.Qualities
|
|
|
|
|
|
|
|
|
|
|
|
private CustomFormat _customFormat1;
|
|
|
|
private CustomFormat _customFormat1;
|
|
|
|
private CustomFormat _customFormat2;
|
|
|
|
private CustomFormat _customFormat2;
|
|
|
|
|
|
|
|
private CustomFormat _customFormat3;
|
|
|
|
|
|
|
|
private CustomFormat _customFormat4;
|
|
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
[SetUp]
|
|
|
|
public void Setup()
|
|
|
|
public void Setup()
|
|
|
@ -80,10 +82,12 @@ namespace NzbDrone.Core.Test.Qualities
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_customFormat1 = new CustomFormat("My Format 1", "L_ENGLISH") { Id = 1 };
|
|
|
|
_customFormat1 = new CustomFormat("My Format 1", "L_ENGLISH") { Id = 1 };
|
|
|
|
_customFormat2 = new CustomFormat("My Format 2", "L_FRENCH") { Id = 2 };
|
|
|
|
_customFormat2 = new CustomFormat("My Format 2", "L_FRENCH") { Id = 2 };
|
|
|
|
|
|
|
|
_customFormat3 = new CustomFormat("My Format 3", "L_SPANISH") { Id = 3 };
|
|
|
|
|
|
|
|
_customFormat4 = new CustomFormat("My Format 4", "L_ITALIAN") { Id = 4 };
|
|
|
|
|
|
|
|
|
|
|
|
CustomFormatsFixture.GivenCustomFormats(CustomFormat.None, _customFormat1, _customFormat2);
|
|
|
|
CustomFormatsFixture.GivenCustomFormats(CustomFormat.None, _customFormat1, _customFormat2, _customFormat3, _customFormat4);
|
|
|
|
|
|
|
|
|
|
|
|
Subject = new QualityModelComparer(new Profile { Items = QualityFixture.GetDefaultQualities(), FormatItems = CustomFormatsFixture.GetSampleFormatItems() });
|
|
|
|
Subject = new QualityModelComparer(new Profile { Items = QualityFixture.GetDefaultQualities(), FormatItems = CustomFormatsFixture.GetSampleFormatItems(), FormatCutoff = _customFormat2.Id });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
@ -189,5 +193,57 @@ namespace NzbDrone.Core.Test.Qualities
|
|
|
|
|
|
|
|
|
|
|
|
compare.Should().BeLessThan(0);
|
|
|
|
compare.Should().BeLessThan(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void should_be_greater_when_one_format_over_cutoff()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GivenDefaultProfileWithFormats();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var first = new List<CustomFormat> { _customFormat3 };
|
|
|
|
|
|
|
|
var second = _customFormat2.Id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var compare = Subject.Compare(first, second);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compare.Should().BeGreaterThan(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void should_be_greater_when_multiple_formats_over_cutoff()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GivenDefaultProfileWithFormats();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var first = new List<CustomFormat> { _customFormat3, _customFormat4 };
|
|
|
|
|
|
|
|
var second = _customFormat2.Id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var compare = Subject.Compare(first, second);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compare.Should().BeGreaterThan(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void should_be_greater_when_one_better_one_worse_than_cutoff()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GivenDefaultProfileWithFormats();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var first = new List<CustomFormat> { _customFormat1, _customFormat3 };
|
|
|
|
|
|
|
|
var second = _customFormat2.Id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var compare = Subject.Compare(first, second);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compare.Should().BeGreaterThan(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void should_be_zero_when_one_worse_one_equal_to_cutoff()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GivenDefaultProfileWithFormats();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var first = new List<CustomFormat> { _customFormat1, _customFormat2 };
|
|
|
|
|
|
|
|
var second = _customFormat2.Id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var compare = Subject.Compare(first, second);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compare.Should().Be(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|