Exemple #1
0
        public static void Init(Type transactionManagerType)
        {
            IWindsorContainer container = new WindsorContainer();

            ComponentRegistrar.AddComponentsTo(container, transactionManagerType);
            RegisterTestServices(container);
            ServiceLocator.SetLocatorProvider(() => new WindsorServiceLocator(container));
        }
Exemple #2
0
        public static void Init()
        {
            IWindsorContainer container = new WindsorContainer();

            ComponentRegistrar.AddComponentsTo(container);
            NHibernateProfiler.Initialize();
            ServiceLocator.SetLocatorProvider(() => new WindsorServiceLocator(container));
        }
            public void All_Components_Can_Be_Created()
            {
                var registrar = new ComponentRegistrar();
                var handlers  = new List <IHandler>();

                registrar.Container.Kernel.ComponentRegistered += (name, handler) => handlers.Add(handler);
                registrar.RegisterComponents();
                // If the container cannot resolve the instance
                // an exception will be thrown and the test will fail!
                handlers.ForEach(handler =>
                {
                    if (!IsFromCastleNamespace(handler) && handler.CurrentState == HandlerState.WaitingDependency)
                    {
                        registrar.Container.Kernel.Resolve(handler.ComponentModel.Name, handler.Service);
                    }
                });
            }