Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created September 5, 2017 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/2b894688e4467c09c95e634fa92408a1 to your computer and use it in GitHub Desktop.
Save justinyoo/2b894688e4467c09c95e634fa92408a1 to your computer and use it in GitHub Desktop.
Make Your Azure WebJobs Testable Again
public class Program
{
public static void Main()
{
// Initialise a configuration.
var handler = new AutofacRegistrationHandler();
handler.RegisterModule = p => p.RegisterModule<WebJobModule>();
var activator = new AutofacJobActivator().RegisterDependencies(handler);
var config = new JobHostConfiguration() { JobActivator = activator };
...
// Initialise a job host.
var host = new JobHost(config);
// Run the job host.
host.RunAndBlock();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment