Hi @odinserj
I have read this howto - How to kick off static `BackgroundJob` methods and write unit tests
But I am using HangFire to enqueue job at service layer rather than MVC controller level and I am writing Unit Tests for the Service. So my MVC controller will call a service layer method. So I have an Interface with two methods on it. Then in my implementation of interface I am using DI so I have something like the following:
private readonly IBackgroundJobClient _jobClient;
public MyService(IBackgroundJobClient jobClient)
{
_jobClient = jobClient;
}
public void MyMethod(string passedId)
{
//SetUp stuff
_jobClient.Enqueue(() => _LongRunningTaskMethod(passedId)
}
What I am wondering is in what way if any should I be handling Dispose here as you mention it in the post I have linked to above. Should that be another method on my interface?