mirror of https://github.com/Radarr/Radarr
55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using FluentAssertions;
|
|
using NUnit.Framework;
|
|
using NzbDrone.Core.DecisionEngine;
|
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
|
using NzbDrone.Core.Indexers;
|
|
using NzbDrone.Core.Parser.Model;
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
namespace NzbDrone.Core.Test.DecisionEngineTests
|
|
{
|
|
[TestFixture]
|
|
|
|
public class BlockedIndexerSpecificationFixture : CoreTest<BlockedIndexerSpecification>
|
|
{
|
|
private RemoteMovie _remoteMovie;
|
|
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
_remoteMovie = new RemoteMovie
|
|
{
|
|
Release = new ReleaseInfo { IndexerId = 1 }
|
|
};
|
|
|
|
Mocker.GetMock<IIndexerStatusService>()
|
|
.Setup(v => v.GetBlockedProviders())
|
|
.Returns(new List<IndexerStatus>());
|
|
}
|
|
|
|
private void WithBlockedIndexer()
|
|
{
|
|
Mocker.GetMock<IIndexerStatusService>()
|
|
.Setup(v => v.GetBlockedProviders())
|
|
.Returns(new List<IndexerStatus> { new IndexerStatus { ProviderId = 1, DisabledTill = DateTime.UtcNow } });
|
|
}
|
|
|
|
[Test]
|
|
public void should_return_true_if_no_blocked_indexer()
|
|
{
|
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
|
}
|
|
|
|
[Test]
|
|
public void should_return_false_if_blocked_indexer()
|
|
{
|
|
WithBlockedIndexer();
|
|
|
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
|
Subject.Type.Should().Be(RejectionType.Temporary);
|
|
}
|
|
}
|
|
}
|