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


C# Fakes.FakeTypeFinder类代码示例

本文整理汇总了C#中Fakes.FakeTypeFinder的典型用法代码示例。如果您正苦于以下问题:C# Fakes.FakeTypeFinder类的具体用法?C# Fakes.FakeTypeFinder怎么用?C# Fakes.FakeTypeFinder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CanResolve_MultipleServices

        public void CanResolve_MultipleServices()
        {
            ITypeFinder finder = new Fakes.FakeTypeFinder(typeof(HighService), typeof(LowService));
            ServiceRegistrator registrator = new ServiceRegistrator(finder, container);
            registrator.RegisterServices(registrator.FindServices());

            var services = container.ResolveAll<IBarometer>();
            Assert.That(services.Count(), Is.EqualTo(2));
        }
开发者ID:joaohortencio,项目名称:n2cms,代码行数:9,代码来源:ServiceDiscovererTests.cs

示例2: Plugin_WithoutInitializerDefinition_IsNotInvoked

        public void Plugin_WithoutInitializerDefinition_IsNotInvoked()
        {
            ITypeFinder typeFinder = new Fakes.FakeTypeFinder(new[] { typeof(PlugIn3) });

            PluginBootstrapper invoker = new PluginBootstrapper(typeFinder);
            invoker.InitializePlugins(null, invoker.GetPluginDefinitions());

            Assert.That(PlugIn3.WasInitialized, Is.False);
        }
开发者ID:Biswo,项目名称:n2cms,代码行数:9,代码来源:PlugInInitializerInvokerTests.cs

示例3: AutoInitializePlugin_IsInvoked

        public void AutoInitializePlugin_IsInvoked()
        {
            ITypeFinder typeFinder = new Fakes.FakeTypeFinder(new[] { typeof(PlugIn2) });

            PluginBootstrapper invoker = new PluginBootstrapper(typeFinder);
            PlugIn2.WasInitialized = false;
            invoker.InitializePlugins(null, invoker.GetPluginDefinitions());

            Assert.That(PlugIn2.WasInitialized, Is.True);
        }
开发者ID:Biswo,项目名称:n2cms,代码行数:10,代码来源:PlugInInitializerInvokerTests.cs

示例4: GenericServices_CanBeResolved

        public void GenericServices_CanBeResolved()
        {
            ITypeFinder finder = new Fakes.FakeTypeFinder(typeof(GenericSelfService<>));

            DependencyAttributeRegistrator registrator = new DependencyAttributeRegistrator(finder, engine);
            registrator.RegisterServices(registrator.FindServices());

            Assert.That(engine.Resolve<GenericSelfService<int>>(), Is.InstanceOf<GenericSelfService<int>>());
            Assert.That(engine.Resolve<GenericSelfService<string>>(), Is.InstanceOf<GenericSelfService<string>>());
        }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:10,代码来源:ServiceDiscovererTests.cs

示例5: CanDependOn_MultipleServices

        public void CanDependOn_MultipleServices()
        {
            ITypeFinder finder = new Fakes.FakeTypeFinder(typeof(HighService), typeof(LowService));
            ServiceRegistrator registrator = new ServiceRegistrator(finder, container);
            registrator.RegisterServices(registrator.FindServices());
            container.AddComponent("bw", typeof(BarometerWatcher), typeof(BarometerWatcher));

            var watcher = container.Resolve<BarometerWatcher>();
            Assert.That(watcher.Barometers.Count(), Is.EqualTo(2));
        }
开发者ID:joaohortencio,项目名称:n2cms,代码行数:10,代码来源:ServiceDiscovererTests.cs

示例6: GenericServices_CanBeResolved_ByServiceInterface

        public void GenericServices_CanBeResolved_ByServiceInterface()
        {
            ITypeFinder finder = new Fakes.FakeTypeFinder(typeof(GenericInterfacedService<>));

            ServiceRegistrator registrator = new ServiceRegistrator(finder, container);
            registrator.RegisterServices(registrator.FindServices());

            Assert.That(container.Resolve<IGenericService<int>>(), Is.InstanceOf<GenericInterfacedService<int>>());
            Assert.That(container.Resolve<IGenericService<string>>(), Is.InstanceOf<GenericInterfacedService<string>>());
        }
开发者ID:spmason,项目名称:n2cms,代码行数:10,代码来源:ServiceDiscovererTests.cs

示例7: Services_AreAdded_ToTheContainer

        public void Services_AreAdded_ToTheContainer()
        {
            ITypeFinder finder = new Fakes.FakeTypeFinder(typeof(SelfService), typeof(NonAttributed));

            ServiceRegistrator registrator = new ServiceRegistrator(finder, container);
            registrator.RegisterServices(registrator.FindServices());

            Assert.That(container.Resolve<SelfService>(), Is.InstanceOf<SelfService>());
            Assert.That(new TestDelegate(() => container.Resolve<NonAttributed>()), Throws.Exception);
        }
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:10,代码来源:ServiceDiscovererTests.cs

示例8: GenericServices_CanDepend_OnEachOther

        public void GenericServices_CanDepend_OnEachOther()
        {
            ITypeFinder finder = new Fakes.FakeTypeFinder(typeof(GenericSelfService<>), typeof(GenericDependingService));

            DependencyAttributeRegistrator registrator = new DependencyAttributeRegistrator(finder, engine);
            registrator.RegisterServices(registrator.FindServices());

            var service = engine.Resolve<GenericDependingService>();
            Assert.That(service, Is.InstanceOf<GenericDependingService>());
            Assert.That(service.service, Is.InstanceOf<GenericSelfService<int>>());
        }
开发者ID:btolbert,项目名称:test-commerce,代码行数:11,代码来源:ServiceDiscovererTests.cs

示例9: Services_CanDepend_OnEachOther

        public void Services_CanDepend_OnEachOther()
        {
            ITypeFinder finder = new Fakes.FakeTypeFinder(typeof(SelfService), typeof(DependingService));

            ServiceRegistrator registrator = new ServiceRegistrator(finder, container);
            registrator.RegisterServices(registrator.FindServices());

            var service = container.Resolve<DependingService>();
            Assert.That(service, Is.InstanceOf<DependingService>());
            Assert.That(service.service, Is.InstanceOf<SelfService>());
        }
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:11,代码来源:ServiceDiscovererTests.cs

示例10: CanResolve_ServiceWithDependency_OnComponentInstance

        public void CanResolve_ServiceWithDependency_OnComponentInstance()
        {
            ITypeFinder finder = new Fakes.FakeTypeFinder(typeof(DependingServiceWithMissingDependency).Assembly.GetTypes());
            ServiceRegistrator registrator = new ServiceRegistrator(finder, container);
            registrator.RegisterServices(registrator.FindServices());

            container.AddComponentInstance("ud", typeof(UnregisteredDependency), new UnregisteredDependency());

            var service = container.Resolve<DependingServiceWithMissingDependency>();
            Assert.That(service, Is.InstanceOf<DependingServiceWithMissingDependency>());
        }
开发者ID:GrimaceOfDespair,项目名称:n2cms,代码行数:11,代码来源:ServiceDiscovererTests.cs

示例11: Services_AreAdded_ToTheContainer_WithServiceType

        public void Services_AreAdded_ToTheContainer_WithServiceType()
        {
            ITypeFinder finder = new Fakes.FakeTypeFinder(typeof(InterfacedService), typeof(NonAttributed));

            DependencyAttributeRegistrator registrator = new DependencyAttributeRegistrator(finder, engine);
            registrator.RegisterServices(registrator.FindServices());

            Assert.That(engine.Resolve<IService>(), Is.Not.Null);
            Assert.That(engine.Resolve<IService>(), Is.InstanceOf<InterfacedService>());
            Assert.That(new TestDelegate(() => engine.Resolve<NonAttributed>()), Throws.Exception);
        }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:11,代码来源:ServiceDiscovererTests.cs

示例12: CanResolve_ServiceWithDependency_OnComponentInstance

        public void CanResolve_ServiceWithDependency_OnComponentInstance()
        {
            ITypeFinder finder = new Fakes.FakeTypeFinder(typeof(DependingServiceWithMissingDependency).Assembly.GetTypes());
            DependencyAttributeRegistrator registrator = new DependencyAttributeRegistrator(finder, engine);
            registrator.RegisterServices(registrator.FindServices());

            engine.ContainerManager.AddComponentInstance<UnregisteredDependency>(new UnregisteredDependency(), "ud");

            var service = engine.Resolve<DependingServiceWithMissingDependency>();
            Assert.That(service, Is.InstanceOf<DependingServiceWithMissingDependency>());
        }
开发者ID:btolbert,项目名称:test-commerce,代码行数:11,代码来源:ServiceDiscovererTests.cs

示例13: Services_AreSingletons

        public void Services_AreSingletons()
        {
            ITypeFinder finder = new Fakes.FakeTypeFinder(typeof(SelfService));

            ServiceRegistrator registrator = new ServiceRegistrator(finder, container);
            registrator.RegisterServices(registrator.FindServices());

            var one = container.Resolve<SelfService>();
            var two = container.Resolve<SelfService>();
            
            Assert.That(object.ReferenceEquals(one, two));
        }
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:12,代码来源:ServiceDiscovererTests.cs

示例14: Services_AreSingletons

        public void Services_AreSingletons()
        {
            ITypeFinder finder = new Fakes.FakeTypeFinder(typeof(SelfService));

            DependencyAttributeRegistrator registrator = new DependencyAttributeRegistrator(finder, engine);
            registrator.RegisterServices(registrator.FindServices());

            var one = engine.Resolve<SelfService>();
            var two = engine.Resolve<SelfService>();

            Assert.That(object.ReferenceEquals(one, two));
        }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:12,代码来源:ServiceDiscovererTests.cs

示例15: AutoInitialized_PluginInitializers_CanBeRemoved_UsingConfiguration_ByType

        public void AutoInitialized_PluginInitializers_CanBeRemoved_UsingConfiguration_ByType()
        {
            ITypeFinder typeFinder = new Fakes.FakeTypeFinder(typeof(PlugIn1).Assembly, new[] { typeof(PlugIn2) });

            EngineSection config = CreateConfiguration(null, new[]
            {
                new PluginInitializerElement { Name = "ignored", Type = typeof(PlugIn2).AssemblyQualifiedName }
            });
            PluginBootstrapper invoker = new PluginBootstrapper(typeFinder, config);
            invoker.InitializePlugins(null, invoker.GetPluginDefinitions());

            Assert.That(PlugIn2.WasInitialized, Is.False);
        }
开发者ID:Jobu,项目名称:n2cms,代码行数:13,代码来源:PlugInInitializerInvokerTests.cs


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