2013-03-28 23:07:09 +01:00
|
|
|
|
|
2013-01-16 02:36:02 +01:00
|
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using Moq;
|
|
|
|
|
using NUnit.Framework;
|
2013-03-07 01:19:49 +01:00
|
|
|
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
2013-01-16 02:36:02 +01:00
|
|
|
|
using NzbDrone.Core.Model;
|
|
|
|
|
using NzbDrone.Core.Providers;
|
2013-02-19 03:19:38 +01:00
|
|
|
|
using NzbDrone.Core.DecisionEngine;
|
2013-03-07 02:51:47 +01:00
|
|
|
|
|
2013-01-16 02:36:02 +01:00
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
|
2013-02-19 03:19:38 +01:00
|
|
|
|
namespace NzbDrone.Core.Test.DecisionEngineTests
|
2013-01-16 02:36:02 +01:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2013-03-28 23:07:09 +01:00
|
|
|
|
|
2013-02-17 06:44:06 +01:00
|
|
|
|
public class LanguageSpecificationFixture : CoreTest
|
2013-01-16 02:36:02 +01:00
|
|
|
|
{
|
2013-04-07 21:01:24 +02:00
|
|
|
|
private IndexerParseResult parseResult;
|
2013-01-16 02:36:02 +01:00
|
|
|
|
|
|
|
|
|
private void WithEnglishRelease()
|
|
|
|
|
{
|
2013-04-07 21:01:24 +02:00
|
|
|
|
parseResult = Builder<IndexerParseResult>
|
2013-01-16 02:36:02 +01:00
|
|
|
|
.CreateNew()
|
|
|
|
|
.With(p => p.Language = LanguageType.English)
|
|
|
|
|
.Build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void WithGermanRelease()
|
|
|
|
|
{
|
2013-04-07 21:01:24 +02:00
|
|
|
|
parseResult = Builder<IndexerParseResult>
|
2013-01-16 02:36:02 +01:00
|
|
|
|
.CreateNew()
|
|
|
|
|
.With(p => p.Language = LanguageType.German)
|
|
|
|
|
.Build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_return_true_if_language_is_english()
|
|
|
|
|
{
|
|
|
|
|
WithEnglishRelease();
|
|
|
|
|
|
|
|
|
|
Mocker.Resolve<LanguageSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_return_false_if_language_is_german()
|
|
|
|
|
{
|
|
|
|
|
WithGermanRelease();
|
|
|
|
|
|
|
|
|
|
Mocker.Resolve<LanguageSpecification>().IsSatisfiedBy(parseResult).Should().BeFalse();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|