Question

I am doing a Unit Testing for a scheduled job, I am using Quartz.net, I am new to this library.

I need to force the trigger to fire on demand, so that the job get executed and I can retrieve the test results. I was using a SimpleTriggerImpl, and I tried to fire the trigger by setting trigger.StartTimeUtc = DateTime.UtcNow, but the job Execute method isn't being called. How can I do this?

Thanks

Was it helpful?

Solution

Get an instance of the scheduler and call the IScheduler.TriggerJob(JobKey jobKey) method. Need to make sure there is another instance that is executing the jobs (IScheduler.Start()).

What job store are you using for your unit tests ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top