public IBusInstance CreateBus(IBusRegistrationContext context, IEnumerable <IBusInstanceSpecification> specifications = null)
        {
            var inMemoryTestHarness = new InMemoryTestHarness(_virtualHost, specifications);

            inMemoryTestHarness.OnConfigureInMemoryBus += configurator => configurator.ConfigureEndpoints(context);

            return(new InMemoryTestHarnessBusInstance(inMemoryTestHarness, context));
        }
        static InMemoryTestHarness CreateInMemoryTestHarness(IContext provider)
        {
            var testHarness = new InMemoryTestHarness();

            var busRegistrationContext = provider.GetInstance <IBusRegistrationContext>();

            testHarness.OnConfigureInMemoryBus += configurator => configurator.ConfigureEndpoints(busRegistrationContext);

            return(testHarness);
        }
示例#3
0
        public IBusInstance CreateBus(IBusRegistrationContext context, IEnumerable <IBusInstanceSpecification> specifications = null)
        {
            var inMemoryTestHarness = new InMemoryTestHarness(_virtualHost, specifications);

            inMemoryTestHarness.OnConfigureInMemoryBus += configurator =>
            {
                var loggerFactory = context.GetService <ILoggerFactory>();
                if (loggerFactory != null)
                {
                    LogContext.ConfigureCurrentLogContext(loggerFactory);
                }

                configurator.ConfigureEndpoints(context);
            };

            return(new InMemoryTestHarnessBusInstance(inMemoryTestHarness, context));
        }
示例#4
0
        public static IWindsorContainer AddInMemoryTestHarness(this IWindsorContainer container, Action <IWindsorContainerBusConfigurator> configure = null)
        {
            container.Register(Component.For <InMemoryTestHarness>().UsingFactoryMethod(kernel =>
            {
                var testHarness = new InMemoryTestHarness();

                var busRegistrationContext          = kernel.Resolve <IBusRegistrationContext>();
                testHarness.OnConfigureInMemoryBus += configurator => configurator.ConfigureEndpoints(busRegistrationContext);

                return(testHarness);
            }).LifestyleSingleton());

            container.AddMassTransit(cfg =>
            {
                configure?.Invoke(cfg);

                cfg.AddBus(context => context.GetRequiredService <InMemoryTestHarness>().BusControl);
            });

            return(container);
        }
示例#5
0
        public static IServiceCollection AddInMemoryTestHarness(this IServiceCollection services,
                                                                Action <IServiceCollectionBusConfigurator> configure = null)
        {
            services.AddSingleton(provider =>
            {
                var testHarness = new InMemoryTestHarness();

                var busRegistrationContext          = provider.GetRequiredService <IBusRegistrationContext>();
                testHarness.OnConfigureInMemoryBus += configurator => configurator.ConfigureEndpoints(busRegistrationContext);

                return(testHarness);
            });

            services.AddMassTransit(cfg =>
            {
                configure?.Invoke(cfg);

                cfg.AddBus(context => context.GetRequiredService <InMemoryTestHarness>().BusControl);
            });

            return(services);
        }
        public static Container AddInMemoryTestHarness(this Container container,
                                                       Action <ISimpleInjectorBusConfigurator> configure = null)
        {
            container.RegisterSingleton(() =>
            {
                var testHarness = new InMemoryTestHarness();

                var busRegistrationContext          = container.GetInstance <IBusRegistrationContext>();
                testHarness.OnConfigureInMemoryBus += configurator => configurator.ConfigureEndpoints(busRegistrationContext);

                return(testHarness);
            });

            container.AddMassTransit(cfg =>
            {
                configure?.Invoke(cfg);

                cfg.AddBus(context => context.GetRequiredService <InMemoryTestHarness>().BusControl);
            });

            return(container);
        }
示例#7
0
 public InMemoryTestHarnessBusInstance(InMemoryTestHarness testHarness, IBusRegistrationContext busRegistrationContext)
 {
     _busRegistrationContext = busRegistrationContext;
     Harness = testHarness;
 }
 public InMemoryTestHarnessBusInstance(InMemoryTestHarness testHarness, RiderConnectable riders)
 {
     _riders = riders;
     Harness = testHarness;
 }