internal IntegrationAppLifetime(IntegrationAppHost host, IntegrationApp app, IApplicationLifetime lifetimeService) { _app = app; host.SetApp(app); host.SetLifetimeService(lifetimeService); }
static void AddIntegrationApp(this IServiceCollection services, IntegrationAppHost host) => services .AddTotemRuntime() .AddTimeline(timeline => timeline.AddEventStore().BindOptionsToConfiguration()) .ConfigureArea(host.GetAreaTypes()) .ConfigureEventStorePorts() .AddEventStoreProcess() .AddSingleton <IClientDb, ClientDb>() .AddSingleton <IntegrationApp>() .AddSingleton <IHostLifetime>(p => new IntegrationAppLifetime( host, p.GetService <IntegrationApp>(), p.GetService <IApplicationLifetime>())) .Add(host.AppServices);
static IEnumerable <Type> GetAreaTypes(this IntegrationAppHost host) => host.TestType.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic);
static void ConfigureIntegrationApp(this IConfigurationBuilder builder, IntegrationAppHost host) => builder .AddJsonFile("appsettings.json") .AddUserSecrets(host.TestType.Assembly);
internal static IHostBuilder ConfigureIntegrationApp(this IHostBuilder builder, IntegrationAppHost host) => builder .ConfigureAppConfiguration(configuration => configuration.ConfigureIntegrationApp(host)) .ConfigureServices(services => services.AddIntegrationApp(host));