Lidarr/src/NzbDrone.Core.Test/XbmcVersionTests.cs

90 lines
2.4 KiB
C#
Raw Normal View History

2013-07-19 03:47:55 +00:00
using FluentAssertions;
2012-12-13 21:52:54 +00:00
using NUnit.Framework;
2013-09-19 01:09:26 +00:00
using NzbDrone.Core.Notifications.Xbmc.Model;
2012-12-13 21:52:54 +00:00
namespace NzbDrone.Core.Test
{
public class XbmcVersionTests
{
[TestCase(6, 0, 0)]
[TestCase(5, 1, 0)]
[TestCase(5, 0, 1)]
public void Icomparer_greater_test(int major, int minor, int patch)
{
var first = new XbmcVersion(5, 0, 0);
var second = new XbmcVersion(major, minor, patch);
second.Should().BeGreaterThan(first);
}
[TestCase(4, 5, 5)]
[TestCase(5, 4, 5)]
[TestCase(5, 5, 4)]
public void Icomparer_lesser_test(int major, int minor, int patch)
{
var first = new XbmcVersion(5, 5, 5);
var second = new XbmcVersion(major, minor, patch);
second.Should().BeLessThan(first);
}
[Test]
public void equal_operand()
{
var first = new XbmcVersion(5, 0, 0);
var second = new XbmcVersion(5, 0, 0);
(first == second).Should().BeTrue();
(first >= second).Should().BeTrue();
(first <= second).Should().BeTrue();
}
[Test]
public void equal_operand_false()
{
var first = new XbmcVersion(5, 0, 0);
var second = new XbmcVersion(6, 0, 0);
(first == second).Should().BeFalse();
}
[Test]
public void not_equal_operand_false()
{
var first = new XbmcVersion(5, 0, 0);
var second = new XbmcVersion(5, 0, 0);
(first != second).Should().BeFalse();
}
[Test]
public void not_equal_operand_true()
{
var first = new XbmcVersion(5, 0, 0);
var second = new XbmcVersion(6, 0, 0);
(first != second).Should().BeTrue();
}
[Test]
public void greater_operand()
{
var first = new XbmcVersion(5, 0, 0);
var second = new XbmcVersion(6, 0, 0);
(first < second).Should().BeTrue();
(first <= second).Should().BeTrue();
}
[Test]
public void lesser_operand()
{
var first = new XbmcVersion(5, 0, 0);
var second = new XbmcVersion(6, 0, 0);
(second > first).Should().BeTrue();
(second >= first).Should().BeTrue();
}
}
}