2011-06-23 09:56:17 +03:00
|
|
|
using FluentAssertions;
|
|
|
|
using NUnit.Framework;
|
2011-05-28 22:23:35 +03:00
|
|
|
using NzbDrone.Core.Model;
|
|
|
|
using NzbDrone.Core.Repository.Quality;
|
2011-06-04 04:56:53 +03:00
|
|
|
using NzbDrone.Core.Test.Framework;
|
2011-05-28 22:23:35 +03:00
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test
|
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
// ReSharper disable InconsistentNaming
|
2013-02-02 23:54:03 +03:00
|
|
|
public class QualityTest : SqlCeTest
|
2011-05-28 22:23:35 +03:00
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void Icomparer_greater_test()
|
|
|
|
{
|
2012-10-14 00:15:21 +03:00
|
|
|
var first = new QualityModel(QualityTypes.DVD, true);
|
|
|
|
var second = new QualityModel(QualityTypes.Bluray1080p, true);
|
2011-05-28 22:23:35 +03:00
|
|
|
|
2011-07-06 09:16:37 +03:00
|
|
|
second.Should().BeGreaterThan(first);
|
2011-05-28 22:23:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Icomparer_greater_proper()
|
|
|
|
{
|
2012-10-14 00:15:21 +03:00
|
|
|
var first = new QualityModel(QualityTypes.Bluray1080p, false);
|
|
|
|
var second = new QualityModel(QualityTypes.Bluray1080p, true);
|
2011-05-28 22:23:35 +03:00
|
|
|
|
2011-07-06 09:16:37 +03:00
|
|
|
second.Should().BeGreaterThan(first);
|
2011-05-28 22:23:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Icomparer_lesser()
|
|
|
|
{
|
2012-10-14 00:15:21 +03:00
|
|
|
var first = new QualityModel(QualityTypes.DVD, true);
|
|
|
|
var second = new QualityModel(QualityTypes.Bluray1080p, true);
|
2011-05-28 22:23:35 +03:00
|
|
|
|
2011-07-06 09:16:37 +03:00
|
|
|
first.Should().BeLessThan(second);
|
2011-05-28 22:23:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Icomparer_lesser_proper()
|
|
|
|
{
|
2012-10-14 00:15:21 +03:00
|
|
|
var first = new QualityModel(QualityTypes.DVD, false);
|
|
|
|
var second = new QualityModel(QualityTypes.DVD, true);
|
2011-05-28 22:23:35 +03:00
|
|
|
|
2011-07-06 09:16:37 +03:00
|
|
|
first.Should().BeLessThan(second);
|
2011-05-28 22:23:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void equal_operand()
|
|
|
|
{
|
2012-10-14 00:15:21 +03:00
|
|
|
var first = new QualityModel(QualityTypes.Bluray1080p, true);
|
|
|
|
var second = new QualityModel(QualityTypes.Bluray1080p, true);
|
2011-05-28 22:23:35 +03:00
|
|
|
|
2011-06-23 09:56:17 +03:00
|
|
|
(first == second).Should().BeTrue();
|
|
|
|
(first >= second).Should().BeTrue();
|
|
|
|
(first <= second).Should().BeTrue();
|
2011-05-28 22:23:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void equal_operand_false()
|
|
|
|
{
|
2012-10-14 00:15:21 +03:00
|
|
|
var first = new QualityModel(QualityTypes.Bluray1080p, true);
|
|
|
|
var second = new QualityModel(QualityTypes.Unknown, true);
|
2011-05-28 22:23:35 +03:00
|
|
|
|
2011-06-23 09:56:17 +03:00
|
|
|
(first == second).Should().BeFalse();
|
2011-05-28 22:23:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void equal_operand_false_proper()
|
|
|
|
{
|
2012-10-14 00:15:21 +03:00
|
|
|
var first = new QualityModel(QualityTypes.Bluray1080p, true);
|
|
|
|
var second = new QualityModel(QualityTypes.Bluray1080p, false);
|
2011-05-28 22:23:35 +03:00
|
|
|
|
2011-06-23 09:56:17 +03:00
|
|
|
(first == second).Should().BeFalse();
|
2011-05-28 22:23:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void not_equal_operand()
|
|
|
|
{
|
2012-10-14 00:15:21 +03:00
|
|
|
var first = new QualityModel(QualityTypes.Bluray1080p, true);
|
|
|
|
var second = new QualityModel(QualityTypes.Bluray1080p, true);
|
2011-05-28 22:23:35 +03:00
|
|
|
|
2011-07-06 09:16:37 +03:00
|
|
|
(first != second).Should().BeFalse();
|
2011-05-28 22:23:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void not_equal_operand_false()
|
|
|
|
{
|
2012-10-14 00:15:21 +03:00
|
|
|
var first = new QualityModel(QualityTypes.Bluray1080p, true);
|
|
|
|
var second = new QualityModel(QualityTypes.Unknown, true);
|
2011-05-28 22:23:35 +03:00
|
|
|
|
2011-06-23 09:56:17 +03:00
|
|
|
(first != second).Should().BeTrue();
|
2011-05-28 22:23:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void not_equal_operand_false_proper()
|
|
|
|
{
|
2012-10-14 00:15:21 +03:00
|
|
|
var first = new QualityModel(QualityTypes.Bluray1080p, true);
|
|
|
|
var second = new QualityModel(QualityTypes.Bluray1080p, false);
|
2011-05-28 22:23:35 +03:00
|
|
|
|
2011-06-23 09:56:17 +03:00
|
|
|
(first != second).Should().BeTrue();
|
2011-05-28 22:23:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void greater_operand()
|
|
|
|
{
|
2012-10-14 00:15:21 +03:00
|
|
|
var first = new QualityModel(QualityTypes.DVD, true);
|
|
|
|
var second = new QualityModel(QualityTypes.Bluray1080p, true);
|
2011-05-28 22:23:35 +03:00
|
|
|
|
2011-06-23 09:56:17 +03:00
|
|
|
(first < second).Should().BeTrue();
|
|
|
|
(first <= second).Should().BeTrue();
|
2011-05-28 22:23:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void lesser_operand()
|
|
|
|
{
|
2012-10-14 00:15:21 +03:00
|
|
|
var first = new QualityModel(QualityTypes.DVD, true);
|
|
|
|
var second = new QualityModel(QualityTypes.Bluray1080p, true);
|
2011-05-28 22:23:35 +03:00
|
|
|
|
2011-06-23 09:56:17 +03:00
|
|
|
(second > first).Should().BeTrue();
|
|
|
|
(second >= first).Should().BeTrue();
|
2011-05-28 22:23:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|