Ejemplo n.º 1
0
        public static ServiceProvider BuildServiceProvider(this IServiceCollection serviceCollection, FlowHandlerTestBase flowHandlerTestBase,
                                                           out IMediator mediator, out ILogger logger)
        {
            var serviceProvider = serviceCollection.BuildServiceProvider();

            mediator = serviceProvider.GetService <IMediator>();
            logger   = serviceProvider.GetLogger(flowHandlerTestBase);

            return(serviceProvider);
        }
Ejemplo n.º 2
0
        public static IServiceCollection AddDebugLogging(this IServiceCollection serviceCollection, FlowHandlerTestBase flowHandlerTestBase,
                                                         StringBuilder loggingOutputBuilder = null)
        {
            serviceCollection
            .AddLogging(configure =>
            {
                configure.SetMinimumLevel(LogLevel.Debug);
                configure.AddProvider(flowHandlerTestBase);
                if (loggingOutputBuilder != null)
                {
                    configure.AddProvider(new TestLoggerProvider(loggingOutputBuilder));
                }
            });

            return(serviceCollection);
        }