public void Install_OnlyRegisterComponentsOfTypeOfIControllers()
        {
            IWindsorContainer containerWithControllers = new WindsorContainer().Install(new ControllersInstaller());

            var allHandlers = containerWithControllers.GetAllHandlers();
            Assert.AreNotEqual(0, allHandlers.Length);
            var controllerHandlers = containerWithControllers.GetHandlersFor(typeof(IController));
            CollectionAssert.AreEquivalent(allHandlers, controllerHandlers);
        }
        public void Install_RegisterComponentsWithTheSameNameThatItsTypes()
        {
            IWindsorContainer containerWithControllers = new WindsorContainer().Install(new RepositoriesInstaller());

            var componentsWithWrongName = containerWithControllers.GetAllHandlers()
                .Where(controller => controller.ComponentModel.Name != controller.ComponentModel.Implementation.Name)
                .ToArray();
            Assert.AreEqual(0, componentsWithWrongName.Length);
        }
        public void Install_RegisterAllRepositoriesWithLifestyleTypePerWebRequest()
        {
            IWindsorContainer containerWithControllers = new WindsorContainer().Install(new RepositoriesInstaller());

            var nonSingletonRepositories = containerWithControllers.GetAllHandlers()
                .Where(controller => controller.ComponentModel.LifestyleType != LifestyleType.PerWebRequest)
                .ToArray();
            Assert.AreEqual(0, nonSingletonRepositories.Length);
        }
Exemplo n.º 4
0
        public void Install_RegisterComponentsWithTheSameNameThatItsTypes()
        {
            IWindsorContainer containerWithControllers = new WindsorContainer().Install(new RepositoriesInstaller());

            var componentsWithWrongName = containerWithControllers.GetAllHandlers()
                                          .Where(controller => controller.ComponentModel.Name != controller.ComponentModel.Implementation.Name)
                                          .ToArray();

            Assert.AreEqual(0, componentsWithWrongName.Length);
        }
Exemplo n.º 5
0
        public void Install_RegisterAllRepositoriesWithLifestyleTypePerWebRequest()
        {
            IWindsorContainer containerWithControllers = new WindsorContainer().Install(new RepositoriesInstaller());

            var nonSingletonRepositories = containerWithControllers.GetAllHandlers()
                                           .Where(controller => controller.ComponentModel.LifestyleType != LifestyleType.PerWebRequest)
                                           .ToArray();

            Assert.AreEqual(0, nonSingletonRepositories.Length);
        }
Exemplo n.º 6
0
        public void Install_OnlyRegisterComponentsOfTypeOfIControllers()
        {
            IWindsorContainer containerWithControllers = new WindsorContainer().Install(new ControllersInstaller());

            var allHandlers = containerWithControllers.GetAllHandlers();

            Assert.AreNotEqual(0, allHandlers.Length);
            var controllerHandlers = containerWithControllers.GetHandlersFor(typeof(IController));

            CollectionAssert.AreEquivalent(allHandlers, controllerHandlers);
        }