|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
@ -5,6 +6,7 @@ using FluentAssertions;
|
|
|
|
|
using Moq;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Core.Books;
|
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
|
|
|
|
using NzbDrone.Core.MediaFiles;
|
|
|
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
@ -244,5 +246,88 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|
|
|
|
.Should()
|
|
|
|
|
.BeFalse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_return_true_when_repacks_are_not_preferred()
|
|
|
|
|
{
|
|
|
|
|
Mocker.GetMock<IConfigService>()
|
|
|
|
|
.Setup(s => s.DownloadPropersAndRepacks)
|
|
|
|
|
.Returns(ProperDownloadTypes.DoNotPrefer);
|
|
|
|
|
|
|
|
|
|
_trackFiles.Select(c =>
|
|
|
|
|
{
|
|
|
|
|
c.ReleaseGroup = "";
|
|
|
|
|
return c;
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
_trackFiles.Select(c =>
|
|
|
|
|
{
|
|
|
|
|
c.Quality = new QualityModel(Quality.FLAC);
|
|
|
|
|
return c;
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
|
|
|
|
.With(e => e.ParsedBookInfo = _parsedBookInfo)
|
|
|
|
|
.With(e => e.Books = _books)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
Subject.IsSatisfiedBy(remoteAlbum, null).Accepted.Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_return_true_when_repack_but_auto_download_repacks_is_true()
|
|
|
|
|
{
|
|
|
|
|
Mocker.GetMock<IConfigService>()
|
|
|
|
|
.Setup(s => s.DownloadPropersAndRepacks)
|
|
|
|
|
.Returns(ProperDownloadTypes.PreferAndUpgrade);
|
|
|
|
|
|
|
|
|
|
_parsedBookInfo.Quality.Revision.IsRepack = true;
|
|
|
|
|
|
|
|
|
|
_trackFiles.Select(c =>
|
|
|
|
|
{
|
|
|
|
|
c.ReleaseGroup = "Lidarr";
|
|
|
|
|
return c;
|
|
|
|
|
}).ToList();
|
|
|
|
|
_trackFiles.Select(c =>
|
|
|
|
|
{
|
|
|
|
|
c.Quality = new QualityModel(Quality.FLAC);
|
|
|
|
|
return c;
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
|
|
|
|
.With(e => e.ParsedBookInfo = _parsedBookInfo)
|
|
|
|
|
.With(e => e.Books = _books)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
Subject.IsSatisfiedBy(remoteAlbum, null).Accepted.Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_return_false_when_repack_but_auto_download_repacks_is_false()
|
|
|
|
|
{
|
|
|
|
|
Mocker.GetMock<IConfigService>()
|
|
|
|
|
.Setup(s => s.DownloadPropersAndRepacks)
|
|
|
|
|
.Returns(ProperDownloadTypes.DoNotUpgrade);
|
|
|
|
|
|
|
|
|
|
_parsedBookInfo.Quality.Revision.IsRepack = true;
|
|
|
|
|
|
|
|
|
|
_trackFiles.Select(c =>
|
|
|
|
|
{
|
|
|
|
|
c.ReleaseGroup = "Lidarr";
|
|
|
|
|
return c;
|
|
|
|
|
}).ToList();
|
|
|
|
|
_trackFiles.Select(c =>
|
|
|
|
|
{
|
|
|
|
|
c.Quality = new QualityModel(Quality.FLAC);
|
|
|
|
|
return c;
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
|
|
|
|
.With(e => e.ParsedBookInfo = _parsedBookInfo)
|
|
|
|
|
.With(e => e.Books = _books)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
Subject.IsSatisfiedBy(remoteAlbum, null).Accepted.Should().BeFalse();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|