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


C# FubuRegistry.BuildGraph方法代码示例

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


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

示例1: SetUp

        public void SetUp()
        {
            registry = new FubuRegistry(x =>
            {

                // Tell FubuMVC to enrich the behavior chain for each
                // RouteHandler with the "FakeUnitOfWorkBehavior"
                // Kind of like a global [ActionFilter] in MVC
                x.Policies.EnrichCallsWith<FakeUnitOfWorkBehavior>(
                    call => call.Method.Name == "SomeAction");

                // Explicit junk you would only do for exception cases to
                // override the conventions
                x.Route<InputModel>("area/sub/{Name}/{Age}")
                    .Calls<TestController>(c => c.SomeAction(null)).OutputToJson();

                x.Route<InputModel>("area/sub2/{Name}/{Age}")
                    .Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Route<InputModel>("area/sub3/{Name}/{Age}")
                    .Calls<TestController>(c => c.ThirdAction(null)).OutputToJson();
            });

            _graph = registry.BuildGraph();
        }
开发者ID:RobertTheGrey,项目名称:fubumvc,代码行数:25,代码来源:EnrichCallsWithTester.cs

示例2: SetUp

        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.Actions.IncludeType<JsonController>();

            theGraph = registry.BuildGraph();
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:7,代码来源:JsonAttributeTesting.cs

示例3: configures_settings_with_default_assemblies_and_namespaces

        public void configures_settings_with_default_assemblies_and_namespaces()
        {
            var registry = new FubuRegistry();
            registry.WithSparkDefaults();

            SparkSettings settings = null;
            registry.Services(x =>
                              	{
                              		settings = (SparkSettings) x.DefaultServiceFor<ISparkSettings>().Value;
                              	});

            registry.BuildGraph();

            settings
                .UseAssemblies
                .ShouldContain(typeof(HtmlTag).Assembly.FullName);

            settings
                .UseAssemblies
                .ShouldContain(typeof(FubuPageExtensions).Assembly.FullName);

            settings
                .UseNamespaces
                .ShouldContain(typeof(FubuRegistryExtensions).Namespace);

            settings
                .UseNamespaces
                .ShouldContain(typeof(FubuPageExtensions).Namespace);

            settings
                .UseNamespaces
                .ShouldContain(typeof(HtmlTag).Namespace);
        }
开发者ID:RobertTheGrey,项目名称:fubumvc,代码行数:33,代码来源:SparkRegistrationTester.cs

示例4: apply_the_simplistic_asset_combination_approach

        public void apply_the_simplistic_asset_combination_approach()
        {
            var registry = new FubuRegistry();
            registry.Assets.CombineAllUniqueAssetRequests();

            registry.BuildGraph().Services.DefaultServiceFor<ICombinationDeterminationService>()
                .Type.ShouldEqual(typeof(CombineAllUniqueSetsCombinationDeterminationService));
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:8,代码来源:AssetExpressionUsageTester.cs

示例5: register_a_custom_missing_asset_handler

        public void register_a_custom_missing_asset_handler()
        {
            var registry = new FubuRegistry();
            registry.Assets.HandleMissingAssetsWith<MyDifferentMissingAssetHandler>();

            registry.BuildGraph().Services.DefaultServiceFor<IMissingAssetHandler>()
                .Type.ShouldEqual(typeof(MyDifferentMissingAssetHandler));
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:8,代码来源:AssetExpressionUsageTester.cs

示例6: YSOD_false

        public void YSOD_false()
        {
            var registry = new FubuRegistry();
            registry.Assets.YSOD_on_missing_assets(false);

            registry.BuildGraph().Services.DefaultServiceFor<IMissingAssetHandler>()
                .Type.ShouldEqual(typeof (TraceOnlyMissingAssetHandler));
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:8,代码来源:AssetExpressionUsageTester.cs

示例7: setupActions

 private BehaviorGraph setupActions()
 {
     var registry = new FubuRegistry();
     registry.Route("a/m1").Calls<Action1>(a => a.M1());
     registry.Route("a/m2").Calls<Action1>(a => a.M2());
     registry.Route("b/m1").Calls<Action2>(b => b.M1());
     registry.Route("b/m2").Calls<Action2>(b => b.M2());
     return registry.BuildGraph();
 }
开发者ID:adbrowne,项目名称:fubumvc,代码行数:9,代码来源:StandardRoutePolicyTester.cs

示例8: uses_the_resource_path_to_do_its_job

        public void uses_the_resource_path_to_do_its_job()
        {
            var registry = new FubuRegistry();
            registry.Actions.IncludeType<Controller1>();

            registry.BuildGraph().BehaviorFor<Controller1>(x => x.get_resource(null)).Route.CreateUrlFromInput(
                new ResourcePath("something/else"))
                .ShouldEqual("resource/something/else");
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:9,代码来源:ResourcePathIntegratedUrlCreationTester.cs

示例9: wraps_handled_actions_with_exception_wrapper

        public void wraps_handled_actions_with_exception_wrapper()
        {
            var registry = new FubuRegistry(r => r.ApplyConvention<APIExceptionConvention<Error500Request>>());
            registry.Actions.IncludeType<Action>();

            var graph = registry.BuildGraph();

            graph.BehaviorFor<Action>(x => x.ApiMethod(null)).IsWrappedBy(typeof(ActionExceptionWrapper<Error500Request>)).ShouldBeTrue();
        }
开发者ID:KevM,项目名称:dovetail-bootstrap,代码行数:9,代码来源:api_exception_convention.cs

示例10: should_put_an_anti_forgery_token_on_the_chain

        public void should_put_an_anti_forgery_token_on_the_chain()
        {
            var registry = new FubuRegistry();
            registry.Actions.IncludeType<Controller1>();

            registry.BuildGraph().BehaviorFor<Controller1>(x => x.MethodWithAF(null))
                .FirstCall()
                .Previous.ShouldBeOfType<AntiForgeryNode>()
                .Salt.ShouldEqual("abc");
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:10,代码来源:AntiForgeryTokenAttributeTester.cs

示例11: integrated_with_fubu_registry

        public void integrated_with_fubu_registry()
        {
            var registry = new FubuRegistry();
            registry.Actions.IncludeType<PartialController>();

            var graph = registry.BuildGraph();

            graph.BehaviorFor<PartialController>(x => x.Go(null)).IsPartialOnly.ShouldBeFalse();
            graph.BehaviorFor<PartialController>(x => x.GoPartial(null)).IsPartialOnly.ShouldBeTrue();
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:10,代码来源:PartialOnlyConventionTester.cs

示例12: register_a_combination_policy_with_CombineWith

        public void register_a_combination_policy_with_CombineWith()
        {
            var registry = new FubuRegistry();
            registry.Assets
                .CombineWith<CombineAllScriptFiles>()
                .CombineWith<CombineAllStylesheets>();

            registry.BuildGraph().Services.ServicesFor(typeof(ICombinationPolicy))
                .Select(x => x.Type).ShouldHaveTheSameElementsAs(typeof(CombineAllScriptFiles), typeof(CombineAllStylesheets));
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:10,代码来源:AssetExpressionUsageTester.cs

示例13: should_only_apply_behavior_once

        public void should_only_apply_behavior_once()
        {
            var hostRegistry = new FubuRegistry();
            var packageRegistry = new FubuPackageRegistry();
            packageRegistry.Actions.IncludeType<Controller1>();
            hostRegistry.Import(packageRegistry, string.Empty);
            theGraph = hostRegistry.BuildGraph();

            var chain = chainFor(x => x.BasicContinuation(null))
                .Output.Writers.OfType<Writer>().ShouldHaveCount(1);
        }
开发者ID:roynmoore,项目名称:fubumvc,代码行数:11,代码来源:AjaxContinuationPolicyIntegratedTester.cs

示例14: SetUp

        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.Import<DiagnosticsRegistration>();

            graph = registry.BuildGraph();
            urls = MockRepository.GenerateMock<IUrlRegistry>();

            graph.Behaviors.Any().ShouldBeTrue();
            graph.Actions().Each(x => Debug.WriteLine(x.Description));
        }
开发者ID:loudej,项目名称:fubumvc,代码行数:11,代码来源:DiagnosticsRegistryTester.cs

示例15: SetUp

        public void SetUp()
        {
            var registry = new FubuRegistry(x =>
            {
                x.Actions.IncludeType<Controller1>();
                x.Actions.IncludeType<Controller2>();

                x.Media.ApplyContentNegotiationToActions(call => call.OutputType() == typeof (ViewModel3));
            });

            theGraph = registry.BuildGraph();
        }
开发者ID:henninga,项目名称:fubumvc,代码行数:12,代码来源:ConnegBehaviorConventionTester.cs


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