You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.9 KiB
66 lines
1.9 KiB
6 years ago
|
using System;
|
||
|
using FluentAssertions;
|
||
|
using Moq;
|
||
|
using NUnit.Framework;
|
||
|
using NzbDrone.Core.Datastore;
|
||
|
using NzbDrone.Core.Indexers;
|
||
|
using NzbDrone.Core.Indexers.Torznab;
|
||
|
using NzbDrone.Core.Parser.Model;
|
||
|
using NzbDrone.Core.Test.Framework;
|
||
|
|
||
|
namespace NzbDrone.Core.Test.IndexerTests
|
||
|
{
|
||
|
[TestFixture]
|
||
|
public class SeedConfigProviderFixture : CoreTest<SeedConfigProvider>
|
||
|
{
|
||
|
[Test]
|
||
|
public void should_not_return_config_for_non_existent_indexer()
|
||
|
{
|
||
|
Mocker.GetMock<IIndexerFactory>()
|
||
|
.Setup(v => v.Get(It.IsAny<int>()))
|
||
|
.Throws(new ModelNotFoundException(typeof(IndexerDefinition), 0));
|
||
|
|
||
|
var result = Subject.GetSeedConfiguration(new RemoteAlbum
|
||
|
{
|
||
|
Release = new ReleaseInfo
|
||
|
{
|
||
|
DownloadProtocol = DownloadProtocol.Torrent,
|
||
|
IndexerId = 0
|
||
|
}
|
||
|
});
|
||
|
|
||
|
result.Should().BeNull();
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void should_return_discography_time_for_discography_packs()
|
||
|
{
|
||
|
var settings = new TorznabSettings();
|
||
|
settings.SeedCriteria.DiscographySeedTime = 10;
|
||
|
|
||
|
Mocker.GetMock<IIndexerFactory>()
|
||
|
.Setup(v => v.Get(It.IsAny<int>()))
|
||
|
.Returns(new IndexerDefinition
|
||
|
{
|
||
|
Settings = settings
|
||
|
});
|
||
|
|
||
|
var result = Subject.GetSeedConfiguration(new RemoteAlbum
|
||
|
{
|
||
|
Release = new ReleaseInfo()
|
||
|
{
|
||
|
DownloadProtocol = DownloadProtocol.Torrent,
|
||
|
IndexerId = 1
|
||
|
},
|
||
|
ParsedAlbumInfo = new ParsedAlbumInfo
|
||
|
{
|
||
|
Discography = true
|
||
|
}
|
||
|
});
|
||
|
|
||
|
result.Should().NotBeNull();
|
||
|
result.SeedTime.Should().Be(TimeSpan.FromMinutes(10));
|
||
|
}
|
||
|
}
|
||
|
}
|