Hi,
I have been partially successful at getting Hangfire working within the XUnit tests. However, I am having one last (I hope) issue. I simply added the following to MyProjectTestModule.cs Preinitialize:
Configuration.BackgroundJobs.UseHangfire(); GlobalConfiguration.Configuration.UseSqlServerStorage(configuration["ConnectionStrings:Hangfire"]);
However, since the structure of the Xunit app does not provide a Configure startup mechanism, where do we put startup code:
var options = new BackgroundJobServerOptions
{
WorkerCount = Environment.ProcessorCount * threads,
Queues = queues,
ServerTimeout = new TimeSpan(0, 2, 0)
};
app.UseHangfireServer(options);
Thank you.
3 Answer(s)
-
0
Your can refer this issue:https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3772
-
0
I'm sorry but I have no clue how that article helps me get access to the IApplicationBuilder app in to an Xunit application that has no Configure() method in the first place.
I apologize for missing something....?
-
0
Hi @statuscast,
I haven't tried this but you should do something like this I guess;
http://docs.hangfire.io/en/latest/background-processing/processing-jobs-in-console-app.html