protected (IHost Host, JobHost JobHost) CreateHost(Type programType, Action <HostBuilder> configure = null, object instance = null) { var hostBuilder = new HostBuilder(); hostBuilder.ConfigureDefaultTestHost(builder => { if (instance != null) { builder.Services.AddSingleton <IJobActivator>(new FakeActivator(instance)); if (Mode != RecordedTestMode.Live) { builder.Services.AddSingleton <TablesAccountProvider, InstrumentedTableClientProvider>(); builder.Services.AddSingleton <RecordedTestBase>(this); } } builder.AddAzureTables(); }, programType); (configure ?? DefaultConfigure).Invoke(hostBuilder); var host = hostBuilder .Build(); var jobHost = host.Services.GetService <IJobHost>() as JobHost; return(host, jobHost); }