Merge branch 'master' of git://github.com/kayone/NzbDrone

This commit is contained in:
Mark McDowall 2011-05-11 11:38:28 -07:00
commit 4d7bb451f2
3 changed files with 55 additions and 1 deletions

View File

@ -231,6 +231,40 @@ namespace NzbDrone.Core.Test
//Assert
Assert.Count(1, timers);
Assert.IsTrue(timers[0].Enable);
}
[Test]
public void Init_Timers_sets_interval_0_to_disabled()
{
var repo = MockLib.GetEmptyRepository();
for (int i = 0; i < 2; i++)
{
var disabledJob = new DisabledJob();
IEnumerable<IJob> fakeTimers = new List<IJob> { disabledJob };
var mocker = new AutoMoqer();
mocker.SetConstant(repo);
mocker.SetConstant(fakeTimers);
var timerProvider = mocker.Resolve<JobProvider>();
timerProvider.Initialize();
}
var mocker2 = new AutoMoqer();
mocker2.SetConstant(repo);
var assertTimerProvider = mocker2.Resolve<JobProvider>();
var timers = assertTimerProvider.All();
//Assert
Assert.Count(1, timers);
Assert.IsFalse(timers[0].Enable);
}
@ -255,6 +289,24 @@ namespace NzbDrone.Core.Test
}
}
public class DisabledJob : IJob
{
public string Name
{
get { return "DisabledJob"; }
}
public int DefaultInterval
{
get { return 0; }
}
public void Start(ProgressNotification notification, int targetId)
{
}
}
public class BrokenJob : IJob
{
public string Name

View File

@ -14,6 +14,8 @@ namespace NzbDrone.Core.Providers.Jobs
/// <summary>
/// Default Interval that this job should run at. In seconds.
/// </summary>
/// <remarks>Setting this value to 0 means the job will not be
/// executed by the schedule and is only triggered manually.</remarks>
int DefaultInterval { get; }

View File

@ -208,7 +208,7 @@ namespace NzbDrone.Core.Providers.Jobs
{
var settings = new JobSetting
{
Enable = true,
Enable = timerProviderLocal.DefaultInterval > 0,
TypeName = timer.GetType().ToString(),
Name = timerProviderLocal.Name,
Interval = timerProviderLocal.DefaultInterval,