public void Creates_RocketHost_ForAssemblies() { var host = new WebJobsBuilder().UseRocketBooster(new Startup(), RocketBooster.For(new[] { typeof(RocketHostTests).Assembly }), rb => { }); host.Should().BeAssignableTo <IWebJobsBuilder>(); }
public void Creates_RocketHost_ForAssemblies() { var host = Host.CreateDefaultBuilder() .LaunchWith(RocketBooster.For(new[] { typeof(RocketHostTests).Assembly })); host.Should().BeAssignableTo <IHostBuilder>(); }
public void Should_UseRocketBooster() { var builder = Host.CreateDefaultBuilder() .UseRocketBooster(RocketBooster.For(AppDomain.CurrentDomain)); var host = builder.Build(); host.Services.Should().NotBeNull(); }
public void Should_UseDiagnosticLogging() { var builder = Host.CreateDefaultBuilder() .UseRocketBooster(RocketBooster.For(AppDomain.CurrentDomain), x => x.UseDiagnosticLogging(c => c.AddConsole())); var host = builder.Build(); host.Services.Should().NotBeNull(); }
public void Should_UseRocketBooster() { var startup = new Startup(); var builder = new WebJobsBuilder() .UseRocketBooster(startup, RocketBooster.For(AppDomain.CurrentDomain), rb => { }); var sp = builder.Services.BuildServiceProvider(); sp.Should().NotBeNull(); }
public void Creates_RocketHost_ForAppDomain() { var host = new WebJobsBuilder().UseRocketBooster( new Startup(), RocketBooster.For(AppDomain.CurrentDomain), rb => { } ); host.Should().BeAssignableTo <IWebJobsBuilder>(); }
public void Creates_RocketHost_WithConfiguration() { var host = Host.CreateDefaultBuilder() .LaunchWith(RocketBooster.For(new[] { typeof(RocketHostTests).Assembly })); var configuration = (IConfigurationRoot)host.Build().Services.GetRequiredService <IConfiguration>(); configuration.Providers.OfType <JsonConfigurationProvider>().Should().HaveCount(3); configuration.Providers.OfType <YamlConfigurationProvider>().Should().HaveCount(6); configuration.Providers.OfType <IniConfigurationProvider>().Should().HaveCount(3); }
public async Task Rocket_Surgery_Hosting() { using var host = Host.CreateDefaultBuilder(Array.Empty <string>()) .LaunchWith(RocketBooster.For(DependencyContext.Default)) .ConfigureLogging(x => x.ClearProviders()) .Build(); await host.StartAsync().ConfigureAwait(false); await host.StopAsync().ConfigureAwait(false); }
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .LaunchWith(RocketBooster.For(DependencyContext.Default)) /* #if UseAutofac * .ConfigureRocketSurgery(builder => builder.UseAutofac()) #endif */ //#if UseDryIoc .ConfigureRocketSurgery(builder => builder.UseDryIoc()) //#endif .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup <Startup>());
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureServices((hostContext, services) => { services.AddHostedService <Worker>(); }) .LaunchWith(RocketBooster.For(DependencyContext.Default)) /* #if UseAutofac * .ConfigureRocketSurgery(builder => builder.UseAutofac()) #endif */ //#if UseDryIoc .ConfigureRocketSurgery(builder => builder.UseDryIoc()) //#endif ;
public static Task <int> Main(string[] args) { var diagnosticSource = new DiagnosticListener("Extensions.Host"); var builder = Host.CreateDefaultBuilder(args) .LaunchWith(RocketBooster.For(DependencyContext.Default, diagnosticSource)) .ConfigureRocketSurgery(b => b.AppendConvention(new Convention())) .ConfigureWebHostDefaults(x => x .UseKestrel() .UseStartup <Startup>() ); return(builder .RunCli()); }
public void Should_Call_Through_To_Delegate_Methods() { var startup = new Startup(); var builder = new WebJobsBuilder() .UseRocketBooster( startup, RocketBooster.For(DependencyContext.Load(typeof(RocketHostTests).Assembly)), rb => rb .UseScanner(AutoFake.Resolve <IConventionScanner>()) .PrependDelegate(new Action(() => { })) .AppendDelegate(new Action(() => { })) ); A.CallTo(() => AutoFake.Resolve <IConventionScanner>().PrependDelegate(A <Delegate> ._)).MustHaveHappened(1, Times.Exactly); A.CallTo(() => AutoFake.Resolve <IConventionScanner>().AppendDelegate(A <Delegate> ._)).MustHaveHappened(1, Times.Exactly); }
public void Creates_RocketHost_WithModifiedConfiguration() { var host = Host.CreateDefaultBuilder() .LaunchWith(RocketBooster.For(new[] { typeof(RocketHostTests).Assembly })) .ConfigureRocketSurgery( c => { var options = c.GetOrAdd(() => new ConfigurationOptions()); options.EnvironmentConfiguration.Clear(); } ); var configuration = (IConfigurationRoot)host.Build().Services.GetRequiredService <IConfiguration>(); configuration.Providers.OfType <JsonConfigurationProvider>().Should().HaveCount(1); configuration.Providers.OfType <YamlConfigurationProvider>().Should().HaveCount(2); configuration.Providers.OfType <IniConfigurationProvider>().Should().HaveCount(1); }
public static Task <int> Main(string[] args) { var diagnosticSource = new DiagnosticListener("Extensions.Host"); return(Host.CreateDefaultBuilder(args) .LaunchWith(RocketBooster.For(DependencyContext.Default, diagnosticSource)) .ConfigureRocketSurgery(b => b.AppendConvention(new Convention()) .AppendDelegate(new CommandLineConventionDelegate(c => c.OnRun(x => { Console.WriteLine($" Debug: {x.Debug}"); Console.WriteLine($" Trace: {x.Trace}"); Console.WriteLine($" LogLevel: {x.GetLogLevel()}"); Console.WriteLine($" Verbose: {x.Verbose}"); Console.WriteLine($" IsDefaultCommand: {x.IsDefaultCommand}"); Console.WriteLine($" RemainingArguments: {string.Join(" ", x.RemainingArguments)}"); return 1234; })))) .RunCli()); }
public void Creates_RocketHost_ForAppDomain() { var host = Host.CreateDefaultBuilder().LaunchWith(RocketBooster.For(AppDomain.CurrentDomain)); host.Should().BeAssignableTo <IHostBuilder>(); }
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .LaunchWith(RocketBooster.For(DependencyContext.Default)) .ConfigureRocketSurgery( builder => builder.ConfigureServices(x => { }).ConfigureCommandLine(cl => cl.OnRun(_ => 1)) );
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .LaunchWith(RocketBooster.For(DependencyContext.Default));