Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created September 5, 2017 13:06
Show Gist options
  • Save justinyoo/ad98e39d9b46cf18c34617b10a640561 to your computer and use it in GitHub Desktop.
Save justinyoo/ad98e39d9b46cf18c34617b10a640561 to your computer and use it in GitHub Desktop.
Make Your Azure WebJobs Testable Again
public abstract class JobHostBuilder : IJobHostBuilder
{
private readonly IJobHostConfigurationBuilder _config;
private JobHost _host;
protected JobHostBuilder(IJobHostConfigurationBuilder config)
{
this._config = config;
}
public IJobHostBuilder AddConfiguration(Action<JobHostConfiguration> action)
{
this._config.AddCofiguration(action);
return this;
}
public void BuildHost()
{
this._host = new JobHost(this._config.Build());
}
public void RunAndBlock()
{
this._host.RunAndBlock();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment