コード例 #1
0
        public void apply_policy_to_import_only_applies_to_the_chains_in_the_imported_registry()
        {
            import.Route("a/m1").Calls <Action1>(x => x.M1());
            import.Route("a/m2").Calls <Action1>(x => x.M2());

            import.Policies.Add(policy => policy.Wrap.WithBehavior <Wrapper>());

            parent.Import(import, "import");

            parent.Route("b/m1").Calls <Action2>(x => x.M1());
            parent.Route("b/m2").Calls <Action2>(x => x.M2());

            var graph = BehaviorGraph.BuildFrom(parent);

            // Chains from the import should have the wrapper
            var chain = graph.BehaviorFor <Action1>(x => x.M1());

            chain.IsWrappedBy(typeof(Wrapper)).ShouldBeTrue();

            graph.BehaviorFor <Action1>(x => x.M2()).IsWrappedBy(typeof(Wrapper)).ShouldBeTrue();


            // Chains from the parent should not have the wrapper
            graph.BehaviorFor <Action2>(x => x.M1()).IsWrappedBy(typeof(Wrapper)).ShouldBeFalse();
            graph.BehaviorFor <Action2>(x => x.M2()).IsWrappedBy(typeof(Wrapper)).ShouldBeFalse();
        }
コード例 #2
0
 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();
 }
コード例 #3
0
        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());
            registry.Route("c/m1async").Calls <Action3>(b => b.M1Async());
            return(BehaviorGraph.BuildFrom(registry));
        }
コード例 #4
0
        public void adds_chains_from_import_with_a_prefix()
        {
            import.Route("a/m1").Calls <Action1>(x => x.M1());
            import.Route("a/m2").Calls <Action1>(x => x.M2());
            parent.Import(import, "import");

            var graph = BehaviorGraph.BuildFrom(parent);

            graph.BehaviorFor <Action1>(x => x.M1()).GetRoutePattern().ShouldEqual("import/a/m1");
            graph.BehaviorFor <Action1>(x => x.M2()).GetRoutePattern().ShouldEqual("import/a/m2");
        }
コード例 #5
0
        public void Configure(FubuRegistry registry)
        {
            registry.Route("_fubu/getting_started").Calls <StartingController>(x => x.GettingStarted());

            registry.Configure(graph =>
            {
                var chain = graph.FindHomeChain();
                if (chain == null)
                {
                    graph.BehaviorFor <StartingController>(x => x.GettingStarted()).Route = new RouteDefinition(string.Empty);
                }
            });
        }
コード例 #6
0
 public void Configure(FubuRegistry registry)
 {
     registry.Route("hello").Calls <RandomExtension>(x => x.SayHello());
 }
コード例 #7
0
 public void Configure(FubuRegistry registry)
 {
     registry.Route("_menu").Calls <MenuEndpoint>(x => x.MenuQuery(null));
 }