private async Task <(IConsumer <IEmployeeDeleted>, IntegrationDbContext)> CreateEmployeeDeleteSetup() { var settings = new Dictionary <string, string>(); settings.Add("Common_Api_Url", "http://localhost"); Action <IServiceCollection> actions = (sc) => { _actions(sc); sc.AddSingleton <IConsumer <IEmployeeDeleted>, EmployeeDeletedConsumer>(); }; var testServer = new TestServerBuilder() .WithPostConfigureCollection(actions) .WithConfigSettings(settings) .Build <Startup>(); var client = testServer.CreateClientWithJwtToken(_customerId, _userId); var dbFactory = testServer.Host.Services.GetService <IDbContextFactory <IntegrationDbContext> >(); var context = await dbFactory.CreateDbContext(); var consumer = testServer.Host.Services.GetService <IConsumer <IEmployeeDeleted> >(); return(consumer, context); }