public void ShouldReleaseController()
        {
            var mockContainer = MockRepository.GenerateStub<IWindsorContainer>();
            var controller = new WindsorSimpleController();
            var factory = new WindsorControllerFactory(mockContainer);

            factory.ReleaseController(controller);

            mockContainer.AssertWasCalled(c => c.Release(controller));
        }
Beispiel #2
0
        private static void RegisterWindsor()
        {
            var container = new WindsorContainer();
            var types = typeof(HomeController).Assembly.GetTypes();
            container.Register(Component.For<BlogData>());

            foreach (var controller in
                types.Where(t => typeof(IController).IsAssignableFrom(t)))
            {
                container.Register(
                        Component.For(controller)
                            .LifeStyle.Transient);
            }

            var dict = new Hashtable {{"name", "This is My Dashboard"}};
            container.Kernel.RegisterCustomDependencies(typeof (DashboardController), dict);

            var cf = new WindsorControllerFactory(container);
            ControllerBuilder.Current.SetControllerFactory(cf);
        }