1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-30 11:46:09 +00:00
Sonarr/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs

84 lines
2.2 KiB
C#
Raw Normal View History

using FluentAssertions;
2012-02-17 09:52:29 +00:00
using NUnit.Framework;
2013-02-24 06:48:52 +00:00
using NzbDrone.Core.Configuration;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Parser.Model;
2012-02-17 09:52:29 +00:00
using NzbDrone.Core.Test.Framework;
2013-02-19 02:19:38 +00:00
namespace NzbDrone.Core.Test.DecisionEngineTests
2012-02-17 09:52:29 +00:00
{
[TestFixture]
public class RetentionSpecificationFixture : CoreTest<RetentionSpecification>
2012-02-17 09:52:29 +00:00
{
private RemoteEpisode parseResult;
2012-02-17 09:52:29 +00:00
[SetUp]
public void Setup()
{
parseResult = new RemoteEpisode
2012-02-17 09:52:29 +00:00
{
Report = new ReportInfo
{
Age = 100
}
2012-02-17 09:52:29 +00:00
};
}
private void WithUnlimitedRetention()
{
2013-02-24 19:39:31 +00:00
Mocker.GetMock<IConfigService>().SetupGet(c => c.Retention).Returns(0);
2012-02-17 09:52:29 +00:00
}
private void WithLongRetention()
{
2013-02-24 19:39:31 +00:00
Mocker.GetMock<IConfigService>().SetupGet(c => c.Retention).Returns(1000);
2012-02-17 09:52:29 +00:00
}
private void WithShortRetention()
{
2013-02-24 19:39:31 +00:00
Mocker.GetMock<IConfigService>().SetupGet(c => c.Retention).Returns(10);
2012-02-17 09:52:29 +00:00
}
private void WithEqualRetention()
{
2013-02-24 19:39:31 +00:00
Mocker.GetMock<IConfigService>().SetupGet(c => c.Retention).Returns(100);
2012-02-17 09:52:29 +00:00
}
[Test]
public void unlimited_retention_should_return_true()
{
WithUnlimitedRetention();
Subject.IsSatisfiedBy(parseResult).Should().BeTrue();
2012-02-17 09:52:29 +00:00
}
[Test]
public void longer_retention_should_return_true()
{
WithLongRetention();
Subject.IsSatisfiedBy(parseResult).Should().BeTrue();
2012-02-17 09:52:29 +00:00
}
[Test]
public void equal_retention_should_return_true()
{
WithEqualRetention();
Subject.IsSatisfiedBy(parseResult).Should().BeTrue();
2012-02-17 09:52:29 +00:00
}
[Test]
public void shorter_retention_should_return_false()
{
WithShortRetention();
Subject.IsSatisfiedBy(parseResult).Should().BeFalse();
2012-02-17 09:52:29 +00:00
}
[Test]
public void zeroDay_report_should_return_true()
{
WithUnlimitedRetention();
Subject.IsSatisfiedBy(parseResult).Should().BeTrue();
2012-02-17 09:52:29 +00:00
}
}
}