1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-01 00:12:30 +01:00
Sonarr/NzbDrone.Core.Test/DecisionEngineTests/AllowedReleaseGroupSpecificationFixture.cs

58 lines
1.8 KiB
C#
Raw Normal View History

using FluentAssertions;
using NUnit.Framework;
2013-04-17 05:52:43 +02:00
using NzbDrone.Core.Configuration;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
2013-02-19 03:19:38 +01:00
namespace NzbDrone.Core.Test.DecisionEngineTests
{
[TestFixture]
2013-04-07 19:53:04 +02:00
public class AllowedReleaseGroupSpecificationFixture : CoreTest<AllowedReleaseGroupSpecification>
{
private RemoteEpisode _parseResult;
[SetUp]
public void Setup()
{
_parseResult = new RemoteEpisode
{
Report = new ReportInfo
{
ReleaseGroup = "2HD"
}
};
}
[Test]
public void should_be_true_when_allowedReleaseGroups_is_empty()
{
2013-04-17 05:52:43 +02:00
Subject.IsSatisfiedBy(_parseResult).Should().BeTrue();
}
[Test]
public void should_be_true_when_allowedReleaseGroups_is_nzbs_releaseGroup()
{
Subject.IsSatisfiedBy(_parseResult).Should().BeTrue();
}
2013-04-17 05:52:43 +02:00
[TestCase("2HD")]
[TestCase("2hd")]
[TestCase("other, 2hd, next")]
[TestCase("other,2hd,next")]
[TestCase("other,2hd,next,")]
public void should_be_true_when_allowedReleaseGroups_contains_nzbs_releaseGroup(string allowedList)
{
2013-04-17 05:52:43 +02:00
Mocker.GetMock<IConfigService>().SetupGet(c => c.AllowedReleaseGroups).Returns(allowedList);
Subject.IsSatisfiedBy(_parseResult).Should().BeTrue();
}
[Test]
public void should_be_false_when_allowedReleaseGroups_does_not_contain_nzbs_releaseGroup()
{
2013-04-17 05:52:43 +02:00
Mocker.GetMock<IConfigService>().SetupGet(c => c.AllowedReleaseGroups).Returns("other");
Subject.IsSatisfiedBy(_parseResult).Should().BeFalse();
}
}
}