@@ -31,7 +31,7 @@ public class RecurringJobSchedulerFacts
31
31
private readonly BackgroundJobMock _backgroundJobMock ;
32
32
33
33
private static readonly string _expressionString = "* * * * *" ;
34
- private static readonly TimeSpan _delay = TimeSpan . FromMilliseconds ( 100 ) ;
34
+ private static readonly TimeSpan _delay = TimeSpan . FromMilliseconds ( 1 ) ;
35
35
private readonly CronExpression _cronExpression = CronExpression . Parse ( _expressionString ) ;
36
36
private readonly DateTime _nowInstant = new DateTime ( 2017 , 03 , 30 , 15 , 30 , 0 , DateTimeKind . Utc ) ;
37
37
private readonly DateTime _nextInstant ;
@@ -716,7 +716,7 @@ public void Execute_TriggersRecurringJobOnce_WithMissedScheduleByDefault(bool ba
716
716
_recurringJob [ "Cron" ] = "0 * * * *" ;
717
717
_recurringJob [ "LastExecution" ] = JobHelper . SerializeDateTime ( _nowInstant . AddDays ( - 1 ) ) ;
718
718
719
- var scheduler = CreateScheduler ( ) ;
719
+ var scheduler = CreateScheduler ( delay : TimeSpan . FromMilliseconds ( 100 ) ) ;
720
720
721
721
// Act
722
722
scheduler . Execute ( _context . Object ) ;
@@ -747,7 +747,7 @@ public void Execute_TriggersRecurringJobMultipleTimes_WithMissedScheduleWhenStri
747
747
_recurringJob [ "LastExecution" ] = JobHelper . SerializeDateTime ( _nowInstant . AddHours ( - 3 ) ) ;
748
748
_recurringJob [ "Misfire" ] = MisfireHandlingMode . Strict . ToString ( "D" ) ;
749
749
750
- var scheduler = CreateScheduler ( ) ;
750
+ var scheduler = CreateScheduler ( delay : TimeSpan . FromMilliseconds ( 100 ) ) ;
751
751
752
752
// Act
753
753
scheduler . Execute ( _context . Object ) ;
@@ -786,7 +786,7 @@ public void Execute_DoesNotTriggerRecurringJob_WithMissedScheduleWhenIgnorableMo
786
786
_recurringJob [ "LastExecution" ] = JobHelper . SerializeDateTime ( _nowInstant . AddHours ( - 3 ) ) ;
787
787
_recurringJob [ "Misfire" ] = MisfireHandlingMode . Ignorable . ToString ( "D" ) ;
788
788
789
- var scheduler = CreateScheduler ( ) ;
789
+ var scheduler = CreateScheduler ( delay : TimeSpan . FromMilliseconds ( 100 ) ) ;
790
790
791
791
// Act
792
792
scheduler . Execute ( _context . Object ) ;
@@ -816,7 +816,7 @@ public void Execute_TriggersRecurringJob_WhenIgnorableModeIsUsed_AndErrorIsSligh
816
816
_recurringJob [ "LastExecution" ] = JobHelper . SerializeDateTime ( _nowInstant . AddHours ( - 3 ) ) ;
817
817
_recurringJob [ "Misfire" ] = MisfireHandlingMode . Ignorable . ToString ( "D" ) ;
818
818
819
- var scheduler = CreateScheduler ( ) ;
819
+ var scheduler = CreateScheduler ( delay : TimeSpan . FromMilliseconds ( 100 ) ) ;
820
820
821
821
// Act
822
822
scheduler . Execute ( _context . Object ) ;
@@ -847,7 +847,7 @@ public void Execute_DoesNotMissCurrentExecution_ForAnyMisfireHandlingMode(bool b
847
847
_recurringJob [ "LastExecution" ] = JobHelper . SerializeDateTime ( _nowInstant . AddHours ( - 3 ) ) ;
848
848
_recurringJob [ "Misfire" ] = mode . ToString ( "D" ) ;
849
849
850
- var scheduler = CreateScheduler ( ) ;
850
+ var scheduler = CreateScheduler ( delay : TimeSpan . FromMilliseconds ( 100 ) ) ;
851
851
852
852
// Act
853
853
scheduler . Execute ( _context . Object ) ;
@@ -1310,11 +1310,11 @@ private void EnableBatching()
1310
1310
. Throws ( new ArgumentNullException ( "key" ) ) ;
1311
1311
}
1312
1312
1313
- private RecurringJobScheduler CreateScheduler ( DateTime ? lastExecution = null )
1313
+ private RecurringJobScheduler CreateScheduler ( DateTime ? lastExecution = null , TimeSpan ? delay = null )
1314
1314
{
1315
1315
var scheduler = new RecurringJobScheduler (
1316
1316
_factory . Object ,
1317
- _delay ,
1317
+ delay ?? _delay ,
1318
1318
_timeZoneResolver . Object ,
1319
1319
_nowInstantFactory ) ;
1320
1320
0 commit comments