2012-08-07 08:24:15 +03:00
|
|
|
// ReSharper disable RedundantUsingDirective
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
using FluentAssertions;
|
|
|
|
using Moq;
|
|
|
|
using NUnit.Framework;
|
2013-02-24 09:48:52 +03:00
|
|
|
using NzbDrone.Core.Configuration;
|
2013-02-27 06:19:22 +03:00
|
|
|
using NzbDrone.Core.Qualities;
|
2013-02-19 09:01:03 +03:00
|
|
|
using NzbDrone.Core.Tv;
|
2012-08-07 08:24:15 +03:00
|
|
|
using NzbDrone.Core.Model;
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
2013-02-19 05:19:38 +03:00
|
|
|
using NzbDrone.Core.DecisionEngine;
|
2012-08-07 08:24:15 +03:00
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
2013-02-19 05:19:38 +03:00
|
|
|
namespace NzbDrone.Core.Test.DecisionEngineTests
|
2012-08-07 08:24:15 +03:00
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
// ReSharper disable InconsistentNaming
|
2013-02-17 08:44:06 +03:00
|
|
|
public class AllowedReleaseGroupSpecificationFixture : CoreTest
|
2012-08-07 08:24:15 +03:00
|
|
|
{
|
|
|
|
private EpisodeParseResult parseResult;
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
public void Setup()
|
|
|
|
{
|
|
|
|
parseResult = new EpisodeParseResult
|
|
|
|
{
|
|
|
|
SeriesTitle = "Title",
|
|
|
|
Language = LanguageType.English,
|
2013-02-27 06:19:22 +03:00
|
|
|
Quality = new QualityModel(Quality.SDTV, true),
|
2012-08-07 08:24:15 +03:00
|
|
|
EpisodeNumbers = new List<int> { 3 },
|
|
|
|
SeasonNumber = 12,
|
|
|
|
AirDate = DateTime.Now.AddDays(-12).Date,
|
|
|
|
ReleaseGroup = "2HD"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_be_true_when_allowedReleaseGroups_is_empty()
|
|
|
|
{
|
2013-02-24 22:39:31 +03:00
|
|
|
Mocker.GetMock<IConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns(String.Empty);
|
2012-08-07 08:24:15 +03:00
|
|
|
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_be_true_when_allowedReleaseGroups_is_nzbs_releaseGroup()
|
|
|
|
{
|
2013-02-24 22:39:31 +03:00
|
|
|
Mocker.GetMock<IConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("2HD");
|
2012-08-07 08:24:15 +03:00
|
|
|
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_be_true_when_allowedReleaseGroups_contains_nzbs_releaseGroup()
|
|
|
|
{
|
2013-02-24 22:39:31 +03:00
|
|
|
Mocker.GetMock<IConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("2HD, LOL");
|
2012-08-07 08:24:15 +03:00
|
|
|
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_be_false_when_allowedReleaseGroups_does_not_contain_nzbs_releaseGroup()
|
|
|
|
{
|
2013-02-24 22:39:31 +03:00
|
|
|
Mocker.GetMock<IConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("LOL,DTD");
|
2012-08-07 08:24:15 +03:00
|
|
|
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeFalse();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|