Example #1
0
        public void SetUp()
        {
            theHttpRequest = OwinHttpRequest.ForTesting();
            UrlContext.Stub("http://server");

            theUrlResolver = new ChainUrlResolver(theHttpRequest);

            theGraph = BehaviorGraph.BuildFrom(registry =>
            {
                registry.Actions.IncludeType<ChainUrlResolverEndpoint>();
            });

            theSimpleChain = theGraph.BehaviorFor<ChainUrlResolverEndpoint>(x => x.get_index());
            theChainWithRouteParams = theGraph.BehaviorFor(typeof(ChainUrlParams));
        }
        void IConfigurationAction.Configure(BehaviorGraph graph)
        {
            var chain = graph.BehaviorFor(_route);
            _nodes.Each(chain.AddToEnd);

            //graph.Observer.RecordStatus("Adding explicit route {0}".ToFormat(_route));
        }
        public void SetUp()
        {
            var registry = new FubuRegistry(x => {
                x.Actions.IncludeClassesSuffixedWithController();

                x.Configure(g =>
                {
                    g.BehaviorFor<AuthorizedController>(c => c.Go(null)).Authorization.AddRole("RoleA");
                });
            });

            graph = BehaviorGraph.BuildFrom(registry);

            goChain = graph.BehaviorFor<AuthorizedController>(x => x.Go(null));
            moveChain = graph.BehaviorFor<AuthorizedController>(x => x.Move(null));
        }
        public void SetUp()
        {
            var registry = new FubuRegistry(x =>
            {
                x.Actions.IncludeTypesNamed(t => t.EndsWith("Controller"));

                x.Configure(g =>
                {
                    g.BehaviorFor<AuthorizedController>(c => c.Go()).Authorization.AddRole("RoleA");
                });
            });

            graph = registry.BuildGraph();

            goChain = graph.BehaviorFor<AuthorizedController>(x => x.Go());
            moveChain = graph.BehaviorFor<AuthorizedController>(x => x.Move());
        }
 public void Configure(BehaviorGraph graph)
 {
     var chain = graph.BehaviorFor<TwitterController>(x => x.Button(null));
     if (!chain.Output.HasView(typeof(Always)))
     {
         chain.Output.Writers.AddToEnd(new WriteDefaultTwitterButton());
     }
 }
 public void Configure(BehaviorGraph graph)
 {
     var chain = graph.BehaviorFor<InlineModelEndpoint>(e => e.post_inline_model(null));
     var validation = chain.ValidationNode();
     if(validation != null)
     {
         validation.Strategies.RegisterStrategy(RenderingStrategy.Inline);
     }
 }
        public void Configure(BehaviorGraph graph)
        {
            var chain = graph.BehaviorFor(typeof (ValidationSummary));
            if (chain == null) return;

            if (!chain.Output.HasView(typeof(Always)))
            {
                chain.Output.Writers.AddToEnd(new DefaultValidationSummaryNode());
            }
        }
        public void Configure(BehaviorGraph graph)
        {
            var chain = graph.BehaviorFor<LoginController>(x => x.Login(null));
            if (chain == null) return;

            if(!chain.Output.HasView(typeof(Always)))
            {
               chain.Output.Writers.AddToEnd(new WriteDefaultLogin()); 
            }
        }
Example #9
0
        public void should_throw_an_exception_if_the_result_is_not_unique()
        {
            var call1 = ActionCall.For<Issue101Endpoint>(x => x.get_hello());
            var call2 = ActionCall.For<Issue101Endpoint>(x => x.get_hello());

            var graph = new BehaviorGraph();
            graph.AddChain().AddToEnd(call1);
            graph.AddChain().AddToEnd(call2);

            Exception<FubuException>.ShouldBeThrownBy(() => {
                graph.BehaviorFor<Issue101Endpoint>(x => x.get_hello());
            });
        }
        public void action_without_json_attributes_or_JsonMessage_input_model_has_no_conneg()
        {
            // You have to make the endpoint get some sort of reader/writer to test the negative case,
            // otherwise the default "use json & xml if nothing else is provided" convention
            // takes over
            var registry = new FubuRegistry();
            registry.Actions.IncludeType<JsonController>();
            registry.Configure(graph =>
            {
                graph.Behaviors.Where(x => x.InputType() == typeof (Input1)).Each(chain =>
                {
                    chain.Input.AddFormatter<XmlFormatter>();
                    chain.Output.AddFormatter<XmlFormatter>();
                });
            });

            theGraph = BehaviorGraph.BuildFrom(registry);

            var theChain = theGraph.BehaviorFor(typeof (Input1));

            theChain.Input.UsesFormatter<JsonFormatter>().ShouldBeFalse();
            theChain.Output.UsesFormatter<JsonFormatter>().ShouldBeFalse();
        }
        public void SetUp()
        {
            theRegistry = new LoggedFubuRegistry();

            // Do it this way so that it gets the assembly package
            container = new Container();
            theGraph = FubuApplication.For(theRegistry).StructureMap(container)
                .Bootstrap().Factory.Get<BehaviorGraph>();

            theGraph.BehaviorFor<LoggedEndpoint>(x => x.get_logged_hello()).ShouldNotBeNull();

            theLogs = container.GetInstance<ConfigLog>();
        }
        public void SetUp()
        {
            FubuTransport.AllQueuesInMemory = true;

            container = new Container();
            container.Inject(new TransportSettings
            {
                DelayMessagePolling = Int32.MaxValue,
                ListenerCleanupPolling = Int32.MaxValue
            });
            theServiceBus = MockRepository.GenerateMock<IServiceBus>();

            theRuntime = FubuApplication.DefaultPolicies().StructureMap(container).Bootstrap();
            theGraph = theRuntime.Factory.Get<BehaviorGraph>();
            chain = theGraph.BehaviorFor<MessageOnePublisher>(x => x.post_message1(null));

            container.Inject(theServiceBus);
        }
 void IConfigurationAction.Configure(BehaviorGraph graph)
 {
     graph.BehaviorFor(_route).AddToEnd(_topBehavior);
     //graph.Observer.RecordStatus("Adding explicit route {0}".ToFormat(_route));
 }
 void IConfigurationAction.Configure(BehaviorGraph graph)
 {
     graph.BehaviorFor(_route).Append(_topBehavior);
 }
        public void SetUp()
        {
            FubuMode.Reset();

            _runtime = FubuApplication.For<ApplicationRegistry>().StructureMap().Bootstrap();
            behaviors = _runtime.Factory.Get<BehaviorGraph>();

            appChain = behaviors.BehaviorFor<ApplicationActions>(x => x.get_app_action());
            pakChain = behaviors.BehaviorFor<PackageActions>(x => x.get_pak_action());
        }