Added unit tests.

This commit is contained in:
Mark McDowall
2012-02-17 01:52:29 -08:00
committed by kay.one
parent 462eb53897
commit 64ca52667b
3 changed files with 113 additions and 0 deletions
@@ -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();
}