@ -7,6 +7,7 @@ using AutoMoq;
using FluentAssertions ;
using Moq ;
using NUnit.Framework ;
using NzbDrone.Core.Model ;
using NzbDrone.Core.Model.Notification ;
using NzbDrone.Core.Providers.Jobs ;
using NzbDrone.Core.Test.Framework ;
@ -84,7 +85,7 @@ namespace NzbDrone.Core.Test
timerProvider . QueueScheduled ( ) ;
Thread . Sleep ( 500 ) ;
fakeJob . Exe x utionCount. Should ( ) . Be ( 1 ) ;
fakeJob . Exe c utionCount. Should ( ) . Be ( 1 ) ;
}
[Test]
@ -106,7 +107,7 @@ namespace NzbDrone.Core.Test
timerProvider . QueueJob ( typeof ( FakeJob ) ) ;
Thread . Sleep ( 1000 ) ;
JobProvider . Queue . Should ( ) . BeEmpty ( ) ;
fakeJob . Exe x utionCount. Should ( ) . Be ( 2 ) ;
fakeJob . Exe c utionCount. Should ( ) . Be ( 2 ) ;
}
[Test]
@ -154,7 +155,7 @@ namespace NzbDrone.Core.Test
Thread . Sleep ( 2000 ) ;
JobProvider . Queue . Should ( ) . BeEmpty ( ) ;
brokenJob . Exe x utionCount. Should ( ) . Be ( 2 ) ;
brokenJob . Exe c utionCount. Should ( ) . Be ( 2 ) ;
ExceptionVerification . ExcpectedErrors ( 2 ) ;
}
@ -184,7 +185,7 @@ namespace NzbDrone.Core.Test
thread2 . Join ( ) ;
slowJob . Exe x utionCount = 2 ;
slowJob . Exe c utionCount = 2 ;
}
@ -216,7 +217,7 @@ namespace NzbDrone.Core.Test
Thread . Sleep ( 5000 ) ;
Assert . AreEqual ( 1 , slowJob . Exe x utionCount) ;
Assert . AreEqual ( 1 , slowJob . Exe c utionCount) ;
JobProvider . Queue . Should ( ) . BeEmpty ( ) ;
}
@ -352,7 +353,7 @@ namespace NzbDrone.Core.Test
//Assert
Assert . AreEqual ( 0 , disabledJob . Exe x utionCount) ;
Assert . AreEqual ( 0 , disabledJob . Exe c utionCount) ;
}
[Test]
@ -411,7 +412,13 @@ namespace NzbDrone.Core.Test
mocker . SetConstant ( MockLib . GetEmptyDatabase ( ) ) ;
mocker . SetConstant ( fakeJobs ) ;
var fakeQueueItem = new Tuple < Type , int > ( fakeJob . GetType ( ) , 12 ) ;
var fakeQueueItem = new JobQueueItem
{
JobType = fakeJob . GetType ( ) ,
TargetId = 12 ,
SecondaryTargetId = 0
} ;
//Act
var jobProvider = mocker . Resolve < JobProvider > ( ) ;
jobProvider . Initialize ( ) ;
@ -420,7 +427,7 @@ namespace NzbDrone.Core.Test
Thread . Sleep ( 1000 ) ;
//Assert
fakeJob . Exe x utionCount. Should ( ) . Be ( 1 ) ;
fakeJob . Exe c utionCount. Should ( ) . Be ( 1 ) ;
}
@ -449,8 +456,8 @@ namespace NzbDrone.Core.Test
//Assert
JobProvider . Queue . Should ( ) . BeEmpty ( ) ;
slowJob . Exe x utionCount. Should ( ) . Be ( 1 ) ;
disabledJob . Exe x utionCount. Should ( ) . Be ( 1 ) ;
slowJob . Exe c utionCount. Should ( ) . Be ( 1 ) ;
disabledJob . Exe c utionCount. Should ( ) . Be ( 1 ) ;
}
}
@ -466,11 +473,11 @@ namespace NzbDrone.Core.Test
get { return 15 ; }
}
public int Exe x utionCount { get ; set ; }
public int Exe c utionCount { get ; set ; }
public void Start ( ProgressNotification notification , int targetId )
public void Start ( ProgressNotification notification , int targetId , int secondaryTargetId )
{
Exe x utionCount+ + ;
Exe c utionCount+ + ;
}
}
@ -486,11 +493,11 @@ namespace NzbDrone.Core.Test
get { return 0 ; }
}
public int Exe x utionCount { get ; set ; }
public int Exe c utionCount { get ; set ; }
public void Start ( ProgressNotification notification , int targetId )
public void Start ( ProgressNotification notification , int targetId , int secondaryTargetId )
{
Exe x utionCount+ + ;
Exe c utionCount+ + ;
}
}
@ -506,11 +513,11 @@ namespace NzbDrone.Core.Test
get { return 15 ; }
}
public int Exe x utionCount { get ; set ; }
public int Exe c utionCount { get ; set ; }
public void Start ( ProgressNotification notification , int targetId )
public void Start ( ProgressNotification notification , int targetId , int secondaryTargetId )
{
Exe x utionCount+ + ;
Exe c utionCount+ + ;
throw new ApplicationException ( "Broken job is broken" ) ;
}
}
@ -527,13 +534,13 @@ namespace NzbDrone.Core.Test
get { return 15 ; }
}
public int Exe x utionCount { get ; set ; }
public int Exe c utionCount { get ; set ; }
public void Start ( ProgressNotification notification , int targetId )
public void Start ( ProgressNotification notification , int targetId , int secondaryTargetId )
{
Console . WriteLine ( "Starting Job" ) ;
Thread . Sleep ( 2000 ) ;
Exe x utionCount+ + ;
Exe c utionCount+ + ;
Console . WriteLine ( "Finishing Job" ) ;
}
}