当前位置: 首页>>代码示例>>C#>>正文


C# WindsorContainer.GetHandlersFor方法代码示例

本文整理汇总了C#中WindsorContainer.GetHandlersFor方法的典型用法代码示例。如果您正苦于以下问题:C# WindsorContainer.GetHandlersFor方法的具体用法?C# WindsorContainer.GetHandlersFor怎么用?C# WindsorContainer.GetHandlersFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WindsorContainer的用法示例。


在下文中一共展示了WindsorContainer.GetHandlersFor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Install_RegisterAllControllersAsTransient

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

            var nonTransientControllers = containerWithControllers.GetHandlersFor(typeof(IController))
                .Where(controller => controller.ComponentModel.LifestyleType != LifestyleType.Transient)
                .ToArray();
            Assert.AreEqual(0, nonTransientControllers.Length);
        }
开发者ID:GustavoRusso,项目名称:standings,代码行数:9,代码来源:ControllersInstallerTest.cs

示例2: Install_OnlyRegisterComponentsOfTypeOfIControllers

        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);
        }
开发者ID:GustavoRusso,项目名称:standings,代码行数:9,代码来源:ControllersInstallerTest.cs

示例3: Install_AllControllersExposeThemselvesAsService

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

            var controllersWithWrongName = containerWithControllers.GetHandlersFor(typeof(IController))
                .Where(controller => controller.Service != controller.ComponentModel.Implementation)
                .ToArray();
            Assert.AreEqual(0, controllersWithWrongName.Length);
        }
开发者ID:GustavoRusso,项目名称:standings,代码行数:9,代码来源:ControllersInstallerTest.cs

示例4: WindsorContainer

        public void GivenRegistrationsInstalled_AndRequestingComponentIsServiceOfferingController_WhenResolve_ThenReturnServiceOfferingFileProcessor()
        {
            Container = new WindsorContainer();
            Container.Kernel.ComponentModelBuilder.AddContributor(new TransientEqualizer());
            Container.Install(Target);
            Container.Register(Component.For<IBlobClient>().Instance(MockRepository.GenerateMock<IBlobClient>()));
            Container.Register(Component.For<IRepositoryContainer>().Instance(MockRepository.GenerateMock<IRepositoryContainer>()));
            Container.Register(Component.For<IPermissionFactory>().Instance(MockRepository.GenerateMock<IPermissionFactory>()));
            var handler = Container.GetHandlersFor(typeof(IFileProcessor)).Single();
            var context = new CreationContext(handler, new LifecycledComponentsReleasePolicy(Container.Kernel), typeof(IFileProcessor), null, null, null);
            handler.ComponentModel.Name = typeof(ServiceOfferingController).FullName;

            var actual = handler.Resolve(context);

            Assert.IsInstanceOfType(actual, typeof(ServiceOfferingFileProcessor));
        }
开发者ID:modulexcite,项目名称:StudentSuccessDashboard,代码行数:16,代码来源:FileProcessorInstallerTest.cs

示例5: Install_RegisterComponentsWithTheSameNameThatItsTypes

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

            var controllersWithWrongName = containerWithControllers.GetHandlersFor(typeof(IController))
                .Where(controller => controller.ComponentModel.Name != controller.ComponentModel.Implementation.Name)
                .ToArray();
            Assert.AreEqual(0, controllersWithWrongName.Length);
        }
开发者ID:GustavoRusso,项目名称:standings,代码行数:9,代码来源:ControllersInstallerTest.cs

示例6: GivenRegistrationsInstalled_AndRequestingComponentIsUnknown_WhenResolve_ThenReturnNullYieldsException

        public void GivenRegistrationsInstalled_AndRequestingComponentIsUnknown_WhenResolve_ThenReturnNullYieldsException()
        {
            Container = new WindsorContainer();
            Container.Kernel.ComponentModelBuilder.AddContributor(new TransientEqualizer());
            Container.Install(Target);
            Container.Register(Component.For<IBlobClient>().Instance(MockRepository.GenerateMock<IBlobClient>()));
            Container.Register(Component.For<IRepositoryContainer>().Instance(MockRepository.GenerateMock<IRepositoryContainer>()));
            Container.Register(Component.For<IPermissionFactory>().Instance(MockRepository.GenerateMock<IPermissionFactory>()));
            var handler = Container.GetHandlersFor(typeof(IFileProcessor)).Single();
            var context = new CreationContext(handler, new LifecycledComponentsReleasePolicy(Container.Kernel), typeof(IFileProcessor), null, null, null);

            Target.ExpectException<ComponentActivatorException>(() => handler.Resolve(context));
        }
开发者ID:modulexcite,项目名称:StudentSuccessDashboard,代码行数:13,代码来源:FileProcessorInstallerTest.cs


注:本文中的WindsorContainer.GetHandlersFor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。