mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-26 09:37:12 +00:00
fixed some tests.
This commit is contained in:
parent
a6a4932b44
commit
ada326af59
5 changed files with 22 additions and 33 deletions
|
@ -47,7 +47,7 @@ public void Setup()
|
|||
|
||||
private void GivenSpecifications(params Mock<IDecisionEngineSpecification>[] mocks)
|
||||
{
|
||||
Mocker.SetConstant(mocks.Select(c => c.Object));
|
||||
Mocker.SetConstant<IEnumerable<IRejectWithReason>>(mocks.Select(c => c.Object));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -55,7 +55,7 @@ public void should_call_all_specifications()
|
|||
{
|
||||
GivenSpecifications(_pass1, _pass2, _pass3, _fail1, _fail2, _fail3);
|
||||
|
||||
Subject.GetRssDecision(_parseResults);
|
||||
Subject.GetRssDecision(_parseResults).ToList();
|
||||
|
||||
_fail1.Verify(c => c.IsSatisfiedBy(_parseResults[0]), Times.Once());
|
||||
_fail2.Verify(c => c.IsSatisfiedBy(_parseResults[0]), Times.Once());
|
||||
|
|
|
@ -1,27 +1,18 @@
|
|||
|
||||
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
[TestFixture]
|
||||
|
||||
public class AllowedReleaseGroupSpecificationFixture : CoreTest
|
||||
public class AllowedReleaseGroupSpecificationFixture : CoreTest<AllowedReleaseGroupSpecification>
|
||||
{
|
||||
private EpisodeParseResult parseResult;
|
||||
|
||||
|
@ -43,29 +34,25 @@ public void Setup()
|
|||
[Test]
|
||||
public void should_be_true_when_allowedReleaseGroups_is_empty()
|
||||
{
|
||||
//Mocker.GetMock<IConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns(String.Empty);
|
||||
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
||||
Subject.IsSatisfiedBy(parseResult).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_true_when_allowedReleaseGroups_is_nzbs_releaseGroup()
|
||||
{
|
||||
//Mocker.GetMock<IConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("2HD");
|
||||
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
||||
Subject.IsSatisfiedBy(parseResult).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_true_when_allowedReleaseGroups_contains_nzbs_releaseGroup()
|
||||
{
|
||||
//Mocker.GetMock<IConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("2HD, LOL");
|
||||
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
||||
Subject.IsSatisfiedBy(parseResult).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_false_when_allowedReleaseGroups_does_not_contain_nzbs_releaseGroup()
|
||||
{
|
||||
//Mocker.GetMock<IConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("LOL,DTD");
|
||||
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeFalse();
|
||||
Subject.IsSatisfiedBy(parseResult).Should().BeFalse();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@
|
|||
namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class BlackholeProviderFixture : CoreTest
|
||||
public class BlackholeProviderFixture : CoreTest<BlackholeProvider>
|
||||
{
|
||||
private const string nzbUrl = "http://www.nzbs.com/url";
|
||||
private const string title = "some_nzb_title";
|
||||
|
@ -39,7 +39,7 @@ private void WithFailedDownload()
|
|||
[Test]
|
||||
public void DownloadNzb_should_download_file_if_it_doesnt_exist()
|
||||
{
|
||||
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, title, false).Should().BeTrue();
|
||||
Subject.DownloadNzb(nzbUrl, title, false).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(nzbUrl, nzbPath), Times.Once());
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public void DownloadNzb_not_download_file_if_it_doesn_exist()
|
|||
{
|
||||
WithExistingFile();
|
||||
|
||||
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, title, false).Should().BeTrue();
|
||||
Subject.DownloadNzb(nzbUrl, title, false).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public void should_return_false_on_failed_download()
|
|||
{
|
||||
WithFailedDownload();
|
||||
|
||||
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, title, false).Should().BeFalse();
|
||||
Subject.DownloadNzb(nzbUrl, title, false).Should().BeFalse();
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public void should_replace_illegal_characters_in_title()
|
|||
var illegalTitle = "Saturday Night Live - S38E08 - Jeremy Renner/Maroon 5 [SDTV]";
|
||||
var expectedFilename = Path.Combine(blackHoleFolder, "Saturday Night Live - S38E08 - Jeremy Renner+Maroon 5 [SDTV].nzb");
|
||||
|
||||
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, illegalTitle, false).Should().BeTrue();
|
||||
Subject.DownloadNzb(nzbUrl, illegalTitle, false).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
|
||||
}
|
||||
|
|
|
@ -230,6 +230,10 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\Libraries\Sqlite\sqlite3.dll">
|
||||
<Link>sqlite3.dll</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="App_Data\Config.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
@ -260,9 +264,6 @@
|
|||
<Content Include="Files\JsonError.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="SQLite.Interop.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="Files\RSS\nzbx_search.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
@ -355,7 +356,8 @@
|
|||
</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy /s /y "$(SolutionDir)\Libraries\Sqlite\*.*" "$(TargetDir)"</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue