mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-19 21:44:30 -04:00
Added unit tests.
This commit is contained in:
+19
@@ -44,6 +44,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
|
||||
Mocker.GetMock<AlreadyInQueueSpecification>()
|
||||
.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>()))
|
||||
.Returns(false);
|
||||
|
||||
Mocker.GetMock<RetentionSpecification>()
|
||||
.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>()))
|
||||
.Returns(true);
|
||||
}
|
||||
|
||||
private void WithProfileNotAllowed()
|
||||
@@ -74,6 +78,13 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
|
||||
.Returns(true);
|
||||
}
|
||||
|
||||
private void WithOverRetention()
|
||||
{
|
||||
Mocker.GetMock<RetentionSpecification>()
|
||||
.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>()))
|
||||
.Returns(false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_allowed_if_all_conditions_are_met()
|
||||
{
|
||||
@@ -108,12 +119,20 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
|
||||
spec.IsSatisfiedBy(parseResult).Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_be_allowed_if_report_is_over_retention()
|
||||
{
|
||||
WithOverRetention();
|
||||
spec.IsSatisfiedBy(parseResult).Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_be_allowed_if_none_of_conditions_are_met()
|
||||
{
|
||||
WithNoDiskUpgrade();
|
||||
WithNotAcceptableSize();
|
||||
WithProfileNotAllowed();
|
||||
WithOverRetention();
|
||||
|
||||
spec.IsSatisfiedBy(parseResult).Should().BeFalse();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user