public void TheyShouldBeResolvable()
        {
            var interceptorTypes = new[] {typeof (DummyInterceptor)};

            var builder = new ContainerBuilder();
            var typeProvider = Substitute.For<ITypeProvider>();
            typeProvider.InterceptorTypes.Returns(interceptorTypes);

            builder.RegisterNimbus(typeProvider);

            using (var container = builder.Build())
            using (var dependencyResolver = container.Resolve<IDependencyResolver>())
            using (var scope = dependencyResolver.CreateChildScope())
            {
                var interceptorSetting = new GlobalOutboundInterceptorTypesSetting
                                         {
                                             Value = interceptorTypes
                                         };
                var outboundInterceptorFactory = new OutboundInterceptorFactory(interceptorSetting,
                                                                                new PropertyInjector(Substitute.For<IClock>(),
                                                                                                     Substitute.For<IDispatchContextManager>(),
                                                                                                     Substitute.For<ILargeMessageBodyStore>()));

                var dummyNimbusMessage = new NimbusMessage("nullQueue");
                var interceptors = outboundInterceptorFactory.CreateInterceptors(scope, dummyNimbusMessage);

                interceptors.Count().ShouldBe(1);
            }
        }
        public void TheyShouldBeResolvable()
        {
            var interceptorTypes = new[] { typeof(DummyInterceptor) };

            var builder      = new ContainerBuilder();
            var typeProvider = Substitute.For <ITypeProvider>();

            typeProvider.InterceptorTypes.Returns(interceptorTypes);

            builder.RegisterNimbus(typeProvider);

            using (var container = builder.Build())
                using (var dependencyResolver = container.Resolve <IDependencyResolver>())
                    using (var scope = dependencyResolver.CreateChildScope())
                    {
                        var interceptorSetting = new GlobalOutboundInterceptorTypesSetting
                        {
                            Value = interceptorTypes
                        };
                        var outboundInterceptorFactory = new OutboundInterceptorFactory(interceptorSetting,
                                                                                        new PropertyInjector(Substitute.For <IClock>(),
                                                                                                             Substitute.For <IDispatchContextManager>(),
                                                                                                             Substitute.For <ILargeMessageBodyStore>()));

                        var dummyNimbusMessage = new NimbusMessage("nullQueue");
                        var interceptors       = outboundInterceptorFactory.CreateInterceptors(scope, dummyNimbusMessage);

                        interceptors.Count().ShouldBe(1);
                    }
        }
        public void TheyShouldBeResolvable()
        {
            var interceptorTypes = new[] {typeof (DummyInterceptor)};

            var builder = new ContainerBuilder();
            var typeProvider = Substitute.For<ITypeProvider>();
            typeProvider.InterceptorTypes.Returns(interceptorTypes);

            builder.RegisterNimbus(typeProvider);

            using (var container = builder.Build())
            using (var dependencyResolver = container.Resolve<IDependencyResolver>())
            using (var scope = dependencyResolver.CreateChildScope())
            {
                var interceptorSetting = new GlobalOutboundInterceptorTypesSetting
                                         {
                                             Value = interceptorTypes
                                         };
                var outboundInterceptorFactory = new OutboundInterceptorFactory(interceptorSetting);
                var interceptors = outboundInterceptorFactory.CreateInterceptors(scope);

                interceptors.Count().ShouldBe(1);
            }
        }
Ejemplo n.º 4
0
 public OutboundInterceptorFactory(GlobalOutboundInterceptorTypesSetting globalOutboundInterceptorTypes, IPropertyInjector propertyInjector)
 {
     _globalOutboundInterceptorTypes = globalOutboundInterceptorTypes;
     _propertyInjector = propertyInjector;
 }
 public OutboundInterceptorFactory(GlobalOutboundInterceptorTypesSetting globalOutboundInterceptorTypes, IPropertyInjector propertyInjector)
 {
     _globalOutboundInterceptorTypes = globalOutboundInterceptorTypes;
     _propertyInjector = propertyInjector;
 }
Ejemplo n.º 6
0
 public OutboundInterceptorFactory(GlobalOutboundInterceptorTypesSetting globalOutboundInterceptorTypes)
 {
     _globalOutboundInterceptorTypes = globalOutboundInterceptorTypes;
 }