2013-07-19 05:47:55 +02:00
|
|
|
|
using FluentAssertions;
|
2011-06-23 08:56:17 +02:00
|
|
|
|
using NUnit.Framework;
|
2013-02-27 04:19:22 +01:00
|
|
|
|
using NzbDrone.Core.Qualities;
|
2013-02-19 07:01:03 +01:00
|
|
|
|
using NzbDrone.Core.Tv;
|
2011-06-04 03:56:53 +02:00
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
2011-05-28 21:23:35 +02:00
|
|
|
|
|
2013-02-27 04:19:22 +01:00
|
|
|
|
namespace NzbDrone.Core.Test.TvTests
|
2011-05-28 21:23:35 +02:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2013-03-28 23:07:09 +01:00
|
|
|
|
|
2013-02-27 04:19:22 +01:00
|
|
|
|
public class QualityModelFixture : CoreTest
|
2011-05-28 21:23:35 +02:00
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void Icomparer_greater_test()
|
|
|
|
|
{
|
2013-02-27 04:19:22 +01:00
|
|
|
|
var first = new QualityModel(Quality.DVD, true);
|
|
|
|
|
var second = new QualityModel(Quality.Bluray1080p, true);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
|
2011-07-06 08:16:37 +02:00
|
|
|
|
second.Should().BeGreaterThan(first);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void Icomparer_greater_proper()
|
|
|
|
|
{
|
2013-02-27 04:19:22 +01:00
|
|
|
|
var first = new QualityModel(Quality.Bluray1080p, false);
|
|
|
|
|
var second = new QualityModel(Quality.Bluray1080p, true);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
|
2011-07-06 08:16:37 +02:00
|
|
|
|
second.Should().BeGreaterThan(first);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void Icomparer_lesser()
|
|
|
|
|
{
|
2013-02-27 04:19:22 +01:00
|
|
|
|
var first = new QualityModel(Quality.DVD, true);
|
|
|
|
|
var second = new QualityModel(Quality.Bluray1080p, true);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
|
2011-07-06 08:16:37 +02:00
|
|
|
|
first.Should().BeLessThan(second);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void Icomparer_lesser_proper()
|
|
|
|
|
{
|
2013-02-27 04:19:22 +01:00
|
|
|
|
var first = new QualityModel(Quality.DVD, false);
|
|
|
|
|
var second = new QualityModel(Quality.DVD, true);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
|
2011-07-06 08:16:37 +02:00
|
|
|
|
first.Should().BeLessThan(second);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void equal_operand()
|
|
|
|
|
{
|
2013-02-27 04:19:22 +01:00
|
|
|
|
var first = new QualityModel(Quality.Bluray1080p, true);
|
|
|
|
|
var second = new QualityModel(Quality.Bluray1080p, true);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
|
2011-06-23 08:56:17 +02:00
|
|
|
|
(first == second).Should().BeTrue();
|
|
|
|
|
(first >= second).Should().BeTrue();
|
|
|
|
|
(first <= second).Should().BeTrue();
|
2011-05-28 21:23:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void equal_operand_false()
|
|
|
|
|
{
|
2013-02-27 04:19:22 +01:00
|
|
|
|
var first = new QualityModel(Quality.Bluray1080p, true);
|
|
|
|
|
var second = new QualityModel(Quality.Unknown, true);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
|
2011-06-23 08:56:17 +02:00
|
|
|
|
(first == second).Should().BeFalse();
|
2011-05-28 21:23:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void equal_operand_false_proper()
|
|
|
|
|
{
|
2013-02-27 04:19:22 +01:00
|
|
|
|
var first = new QualityModel(Quality.Bluray1080p, true);
|
|
|
|
|
var second = new QualityModel(Quality.Bluray1080p, false);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
|
2011-06-23 08:56:17 +02:00
|
|
|
|
(first == second).Should().BeFalse();
|
2011-05-28 21:23:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void not_equal_operand()
|
|
|
|
|
{
|
2013-02-27 04:19:22 +01:00
|
|
|
|
var first = new QualityModel(Quality.Bluray1080p, true);
|
|
|
|
|
var second = new QualityModel(Quality.Bluray1080p, true);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
|
2011-07-06 08:16:37 +02:00
|
|
|
|
(first != second).Should().BeFalse();
|
2011-05-28 21:23:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void not_equal_operand_false()
|
|
|
|
|
{
|
2013-02-27 04:19:22 +01:00
|
|
|
|
var first = new QualityModel(Quality.Bluray1080p, true);
|
|
|
|
|
var second = new QualityModel(Quality.Unknown, true);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
|
2011-06-23 08:56:17 +02:00
|
|
|
|
(first != second).Should().BeTrue();
|
2011-05-28 21:23:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void not_equal_operand_false_proper()
|
|
|
|
|
{
|
2013-02-27 04:19:22 +01:00
|
|
|
|
var first = new QualityModel(Quality.Bluray1080p, true);
|
|
|
|
|
var second = new QualityModel(Quality.Bluray1080p, false);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
|
2011-06-23 08:56:17 +02:00
|
|
|
|
(first != second).Should().BeTrue();
|
2011-05-28 21:23:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void greater_operand()
|
|
|
|
|
{
|
2013-02-27 04:19:22 +01:00
|
|
|
|
var first = new QualityModel(Quality.DVD, true);
|
|
|
|
|
var second = new QualityModel(Quality.Bluray1080p, true);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
|
2011-06-23 08:56:17 +02:00
|
|
|
|
(first < second).Should().BeTrue();
|
|
|
|
|
(first <= second).Should().BeTrue();
|
2011-05-28 21:23:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void lesser_operand()
|
|
|
|
|
{
|
2013-02-27 04:19:22 +01:00
|
|
|
|
var first = new QualityModel(Quality.DVD, true);
|
|
|
|
|
var second = new QualityModel(Quality.Bluray1080p, true);
|
2011-05-28 21:23:35 +02:00
|
|
|
|
|
2011-06-23 08:56:17 +02:00
|
|
|
|
(second > first).Should().BeTrue();
|
|
|
|
|
(second >= first).Should().BeTrue();
|
2011-05-28 21:23:35 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|