2013-07-02 05:34:38 +03:00
|
|
|
using FluentAssertions;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
|
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.DecisionEngineTests
|
|
|
|
{
|
|
|
|
[TestFixture]
|
2013-07-05 07:52:20 +03:00
|
|
|
public class NotRestrictedReleaseSpecificationFixture : CoreTest<NotRestrictedReleaseSpecification>
|
2013-07-02 05:34:38 +03:00
|
|
|
{
|
|
|
|
private RemoteEpisode _parseResult;
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
public void Setup()
|
|
|
|
{
|
|
|
|
_parseResult = new RemoteEpisode
|
|
|
|
{
|
|
|
|
Report = new ReportInfo
|
|
|
|
{
|
|
|
|
Title = "Dexter.S08E01.EDITED.WEBRip.x264-KYR"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_be_true_when_restrictions_are_empty()
|
|
|
|
{
|
2013-08-07 06:18:05 +03:00
|
|
|
Subject.IsSatisfiedBy(_parseResult, null).Should().BeTrue();
|
2013-07-02 05:34:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[TestCase("KYR")]
|
|
|
|
[TestCase("EDITED")]
|
2013-07-02 07:57:49 +03:00
|
|
|
[TestCase("edited")]
|
2013-07-02 05:34:38 +03:00
|
|
|
[TestCase("2HD\nKYR")]
|
2013-07-02 07:57:49 +03:00
|
|
|
[TestCase("2HD\nkyr")]
|
2013-07-02 05:34:38 +03:00
|
|
|
public void should_be_false_when_nzb_contains_a_restricted_term(string restrictions)
|
|
|
|
{
|
2013-07-05 07:52:20 +03:00
|
|
|
Mocker.GetMock<IConfigService>().SetupGet(c => c.ReleaseRestrictions).Returns(restrictions);
|
2013-08-07 06:18:05 +03:00
|
|
|
Subject.IsSatisfiedBy(_parseResult, null).Should().BeFalse();
|
2013-07-02 05:34:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[TestCase("NotReal")]
|
|
|
|
[TestCase("LoL")]
|
|
|
|
[TestCase("Hello\nWorld")]
|
|
|
|
public void should_be_true_when_nzb_does_not_contain_a_restricted_term(string restrictions)
|
|
|
|
{
|
2013-07-05 07:52:20 +03:00
|
|
|
Mocker.GetMock<IConfigService>().SetupGet(c => c.ReleaseRestrictions).Returns(restrictions);
|
2013-08-07 06:18:05 +03:00
|
|
|
Subject.IsSatisfiedBy(_parseResult, null).Should().BeTrue();
|
2013-07-02 05:34:38 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|