本文整理汇总了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();
}
示例2: SetUp
public void SetUp()
{
var registry = new FubuRegistry();
registry.Actions.IncludeType<JsonController>();
theGraph = registry.BuildGraph();
}
示例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);
}
示例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));
}
示例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));
}
示例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));
}
示例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();
}
示例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");
}
示例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();
}
示例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");
}
示例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();
}
示例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));
}
示例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);
}
示例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));
}
示例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();
}