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


C# Container.AssertConfigurationIsValid方法代码示例

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


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

示例1: Compose

    public static IDependencyInjectionContainer Compose()
    {
        // Create the DI container
        var container = new Container();

          container.Configure(expression =>
          {
        expression.For<DomainService<Course>>().HybridHttpOrThreadLocalScoped().Use<CourseDomainSource>();
        expression.For<DomainService<Lead>>().HybridHttpOrThreadLocalScoped().Use<LeadDomainService>();
        expression.For<DomainService<User>>().HybridHttpOrThreadLocalScoped().Use<UserDomainService>();
        expression.For<DomainService<Country>>().HybridHttpOrThreadLocalScoped().Use<CountryDomainService>();

        expression.For<DataProvider<Course>>().HybridHttpOrThreadLocalScoped().Use<CourseDataProvider>();
        expression.For<DataProvider<Lead>>().HybridHttpOrThreadLocalScoped().Use<LeadDataProvider>();
        expression.For<DataProvider<User>>().HybridHttpOrThreadLocalScoped().Use<UserDataProvider>();
        expression.For<DataProvider<Country>>().HybridHttpOrThreadLocalScoped().Use<CountryDataProvider>();
        expression.Scan(scanner =>
        {
          scanner.TheCallingAssembly();
          scanner.WithDefaultConventions();
        });
          });

        // Setup configuration of DI
        container.Configure(r => r.AddRegistry<MvcSiteMapProviderRegistry>());

        #if DEBUG
        container.AssertConfigurationIsValid();
        #endif

        // Return our DI container wrapper instance
        return new StructureMapDependencyInjectionContainer(container);
    }
开发者ID:shanmukhig,项目名称:tms_optimized,代码行数:33,代码来源:CompositionRoot.cs

示例2: PipelineTests

        public PipelineTests()
        {
            var container = new Container(c =>
             {
                 c.Scan(s =>
                 {
                     s.AssemblyContainingType(typeof(RequestPipelineHandler<>));
                     s.ConnectImplementationsToTypesClosing(typeof(IHandle<>));
                     s.ConnectImplementationsToTypesClosing(typeof(IHandle<,>));
                     s.ConnectImplementationsToTypesClosing(typeof(IHandleAsync<>));
                     s.ConnectImplementationsToTypesClosing(typeof(IHandleAsync<,>));
                     s.TheCallingAssembly();
                     s.WithDefaultConventions();
                     s.AddAllTypesOf(typeof(IPreRequestHandler<>));
                     s.AddAllTypesOf(typeof(IPostRequestHandler<>));
                     s.AddAllTypesOf(typeof(IPostRequestResponseHandler<,>));
                 });

                 c.For(typeof(IHandle<>)).DecorateAllWith(typeof(RequestPipelineHandler<>));
                 c.For(typeof(IHandle<,>)).DecorateAllWith(typeof(RequestResponsePipelineHandler<,>));
                 c.For(typeof(IHandleAsync<>)).DecorateAllWith(typeof(AsyncRequestPipelineHandler<>));
                 c.For(typeof(IHandleAsync<,>)).DecorateAllWith(typeof(AsyncRequestResponsePipelineHandler<,>));
             });

            container.AssertConfigurationIsValid();

            _dispatcher = AppDispatcherFactory.Create(app => app.UseCommonServiceLocator(new StructureMapServiceLocator(container)));


        }
开发者ID:AppTonic,项目名称:AppTonic,代码行数:30,代码来源:PipelineTests.cs

示例3: CreateContainer

        public static Container CreateContainer()
        {
            var container = new Container(
                x =>
                {
                    x.For<BotFactory>().Singleton().Use<BotFactoryImpl>();
                    x.For<Bot>().HybridHttpOrThreadLocalScoped().Use<ClassicIrcBot>();

                    x.For<DataSource>().HybridHttpOrThreadLocalScoped().Use<BotDataSource>();
                    x.For<DataSourceConnection>().HybridHttpOrThreadLocalScoped().Use<XMLDataSourceConnection>();

                    x.For<PrivateMessageParser>().Use<PrivateMessageParserImpl>();

                    x.For<Connection>().HybridHttpOrThreadLocalScoped().Use<IrcConnection>();

                    x.For<Handler>().Singleton().Use<BotHandler>();
                    x.For<PluginWatcher>().Singleton().Use<FileSystemPluginWatcher>();
                    x.For<PluginLoader>().Singleton().Use<PluginLoaderImpl>();

                    x.AddRegistry<CommandManagementRegistry>();
                    x.AddRegistry<CommandRegistry>();
                    x.AddRegistry<HandlerRegistry>();
                    x.AddRegistry<EventRegistry>();
                    x.AddRegistry<PluginRegistry>();
                });

            container.AssertConfigurationIsValid();

            return container;
        }
开发者ID:mikoskinen,项目名称:ircbot-dotnet,代码行数:30,代码来源:ContainerCreator.cs

示例4: Initialize

 public static IContainer Initialize()
 {
     var container = new Container(c => c.AddRegistry<DefaultRegistry>());
     GlobalConfiguration.Configuration.Services.Replace(typeof(IHttpControllerActivator), new ServiceActivator(container));
     container.AssertConfigurationIsValid();
     return container;
 }
开发者ID:cmclellen,项目名称:TreeView,代码行数:7,代码来源:IoC.cs

示例5: RavenDBRegistyClassIsValid

 public void RavenDBRegistyClassIsValid()
 {
     using (var container = new Container(cfg => cfg.AddRegistry(new RavenDbRegistry("RavenDB"))))
     {
         container.AssertConfigurationIsValid();
     }
 }
开发者ID:gsuttie,项目名称:Connector,代码行数:7,代码来源:IoCTests.cs

示例6: happy_path_with_validation_method

        public void happy_path_with_validation_method()
        {
            var container =
                new Container(x => { x.For<IWidget>().Use<ValidatingFailureWidget>().Ctor<bool>("fails").Is(false); });

            container.AssertConfigurationIsValid();
        }
开发者ID:khellang,项目名称:structuremap,代码行数:7,代码来源:AssertConfigurationIsValid_Smoke_Tester.cs

示例7: happy_path_with_build_plans_all_good

        public void happy_path_with_build_plans_all_good()
        {
            var container = new Container(x => x.For<IWidget>().Use<NamedWidget>().Ctor<string>().Is("Marshall"));

            // SAMPLE: container.AssertConfigurationIsValid
            container.AssertConfigurationIsValid();
            // ENDSAMPLE
        }
开发者ID:khellang,项目名称:structuremap,代码行数:8,代码来源:AssertConfigurationIsValid_Smoke_Tester.cs

示例8: assert_bootstrapper_is_valid

 public void assert_bootstrapper_is_valid()
 {
     using (var container = new Container())
     {
         
         
         container.AssertConfigurationIsValid();
     }
 }
开发者ID:AbdoNile,项目名称:Foundation,代码行数:9,代码来源:DI.cs

示例9: VerifyValidConfiguration

        public void VerifyValidConfiguration()
        {
            var container = new Container(x =>
            {
                x.For<IService>().Use<Service>();
            });

            container.AssertConfigurationIsValid();
        }
开发者ID:kendaleiv,项目名称:di-servicelocation-structuremap,代码行数:9,代码来源:ValidationTests.cs

示例10: VerifyInvalidConfiguration

        public void VerifyInvalidConfiguration()
        {
            var container = new Container(x =>
            {
                x.For<IService>().Use<BrokenService>();
            });

            Assert.Throws<StructureMapConfigurationException>(
                () => container.AssertConfigurationIsValid());
        }
开发者ID:kendaleiv,项目名称:di-servicelocation-structuremap,代码行数:10,代码来源:ValidationTests.cs

示例11: MissingRequiredConstructorArgument

        public void MissingRequiredConstructorArgument()
        {
            var container = new Container(x =>
            {
                x.For<IService>().Use<ServiceWithCtorArg>();
            });

            Assert.Throws<StructureMapConfigurationException>(
                () => container.AssertConfigurationIsValid());
        }
开发者ID:kendaleiv,项目名称:di-servicelocation-structuremap,代码行数:10,代码来源:ValidationTests.cs

示例12: sad_path_with_validation_method

        public void sad_path_with_validation_method()
        {
            var container =
                new Container(x => { x.For<IWidget>().Use<ValidatingFailureWidget>().Ctor<bool>("fails").Is(true); });

            var ex =
                Exception<StructureMapConfigurationException>.ShouldBeThrownBy(
                    () => { container.AssertConfigurationIsValid(); });

            ex.Title.ShouldBe("StructureMap Failures:  0 Build/Configuration Failures and 1 Validation Errors");
            ex.Context.ShouldContain("Validation Error in Method Validate");
        }
开发者ID:slahn,项目名称:structuremap,代码行数:12,代码来源:AssertConfigurationIsValid_Smoke_Tester.cs

示例13: sad_path_with_an_invalid_build_plan

        public void sad_path_with_an_invalid_build_plan()
        {
            var container = new Container(x => { x.For<IWidget>().Use<NamedWidget>(); });

            var ex =
                Exception<StructureMapConfigurationException>.ShouldBeThrownBy(
                    () => { container.AssertConfigurationIsValid(); });

            ex.Title.ShouldBe("StructureMap Failures:  1 Build/Configuration Failures and 0 Validation Errors");
            ex.Context.ShouldContain(
                "Unable to create a build plan for concrete type StructureMap.Testing.Diagnostics.NamedWidget");
        }
开发者ID:RANENTONG,项目名称:structuremap,代码行数:12,代码来源:AssertConfigurationIsValid_Smoke_Tester.cs

示例14: CanSetupContainer

        public void CanSetupContainer()
        {
            //arrange
            var container = new Container();
            var registrar = new StructuremapRegistrar();

            //act
            registrar.ConfigureDependencies(container, false);

            //assert
            container.AssertConfigurationIsValid();
        }
开发者ID:basicdays,项目名称:Guidelines,代码行数:12,代码来源:BootStrappingTest.cs

示例15: CanSetupContainer

        public void CanSetupContainer()
        {
            //arrange
            var container = new Container();
            var registrar = new StructuremapRegistrar();

            //act
            registrar.ConfigureDependencies(container);

            //assert
            container.AssertConfigurationIsValid();
            //Log.Info(container.WhatDoIHave());
        }
开发者ID:basicdays,项目名称:project_template,代码行数:13,代码来源:DependencyTests.cs


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