The error: Quartz.SchedulerException : Scheduler with name 'DefaultQuartzScheduler'
already exists.
I guess web application factory is used N for N number of tests, while scheduler is being created that number of times.
Applying [assembly: CollectionBehavior(DisableTestParallelization = true)]
to namespace works, but is a hack in my opinion. I am unable to pass any Scheduler instances when running ASP.NET DI.
This is part of my configuration of DI:
services.AddQuartz(options =>
{
options.UseMicrosoftDependencyInjectionJobFactory();
});
services.AddQuartzHostedService(options =>
{
options.WaitForJobsToComplete = true;
});
Fixed this issue by removing all hosted services from my Application Factory.