public void RunLambdaStartupShouldCallConfigureLoggingOnStartup( ServiceCollection serviceCollection, [Substitute] ILambdaStartup startup ) { serviceCollection.AddSingleton(startup); var provider = serviceCollection.BuildServiceProvider(); TestLambdaHostBuilder.RunLambdaStartup(provider, serviceCollection); startup.Received().ConfigureLogging(Arg.Any <ILoggingBuilder>()); }
public void RunLambdaStartupShouldAddConsoleDestinationToLogging( ServiceCollection serviceCollection, [Substitute] ILambdaStartup startup ) { serviceCollection.AddSingleton(startup); var provider = serviceCollection.BuildServiceProvider(); TestLambdaHostBuilder.RunLambdaStartup(provider, serviceCollection); serviceCollection.Should().Contain(descriptor => descriptor.ImplementationType == typeof(ConsoleLoggerProvider)); }
public void RunLambdaStartupShouldAddLoggingToServiceCollection( ServiceCollection serviceCollection, [Substitute] ILambdaStartup startup ) { serviceCollection.AddSingleton(startup); var provider = serviceCollection.BuildServiceProvider(); TestLambdaHostBuilder.RunLambdaStartup(provider, serviceCollection); serviceCollection.Should().Contain(descriptor => descriptor.ServiceType == typeof(ILoggerFactory)); }
public void RunLambdaStartupShouldAddServiceCollection( ServiceCollection serviceCollection, [Substitute] ILambdaStartup startup ) { serviceCollection.AddSingleton(startup); var provider = serviceCollection.BuildServiceProvider(); TestLambdaHostBuilder.RunLambdaStartup(provider, serviceCollection); startup.Received().ConfigureServices(Arg.Is(serviceCollection)); }
public void RunLambdaStartupShouldAddDefaultWarningFilter( ServiceCollection serviceCollection, [Substitute] ILambdaStartup startup ) { serviceCollection.AddSingleton(startup); var provider = serviceCollection.BuildServiceProvider(); TestLambdaHostBuilder.RunLambdaStartup(provider, serviceCollection); var options = serviceCollection.BuildServiceProvider().GetRequiredService <IOptions <LoggerFilterOptions> >(); options.Value.Rules.Should().Contain(rule => rule.CategoryName == TestLambdaHostBuilder.LogCategory && rule.LogLevel == LogLevel.Warning); }