Hangfire Background job to requeue failed jobs unit test

247 views Asked by At

I have created a Hangfire Background job that triggers the failed job as per some CRON schedule. I am facing issues to write Unit test case for the same, specially in mocking for 1st 2 lines. Framework used: xUnit, FakeItEasy

var monitor = JobStorage.Current.GetMonitoringApi();

var failedJobs = monitor.FailedJobs(0, int.MaxValue).Where(m => (m.Value.ExceptionType == "My Custom Exception");

Parallel.ForEach(failedJobs, job =>

{ backgroundJobClient.Requeue(job.Key);

});

0

There are 0 answers