public void SetUp() { _runtime = FubuRuntime.For<ApplicationRegistry>(); behaviors = _runtime.Get<BehaviorGraph>(); appChain = behaviors.ChainFor<ApplicationActions>(x => x.get_app_action()); pakChain = behaviors.ChainFor<PackageActions>(x => x.get_pak_action()); }
public void SetUp() { theHttpRequest = OwinHttpRequest.ForTesting(); UrlContext.Stub("http://server"); theUrlResolver = new ChainUrlResolver(theHttpRequest); theGraph = BehaviorGraph.BuildFrom(registry => { registry.Actions.IncludeType<ChainUrlResolverEndpoint>(); }); theSimpleChain = theGraph.ChainFor<ChainUrlResolverEndpoint>(x => x.get_index()); theChainWithRouteParams = theGraph.ChainFor(typeof(ChainUrlParams)); }
public void SetUp() { var registry = new FubuRegistry(x => { x.Actions.IncludeClassesSuffixedWithController(); x.Configure(g => { g.ChainFor<AuthorizedController>(c => c.Go(null)).Authorization.AddRole("RoleA"); }); }); graph = BehaviorGraph.BuildFrom(registry); goChain = graph.ChainFor<AuthorizedController>(x => x.Go(null)); moveChain = graph.ChainFor<AuthorizedController>(x => x.Move(null)); }
public void move_behavior_before_authorization() { // Ordinarily, AuthorizationNode would be before any other behavior wrappers var chain = graph.ChainFor <OrderingPolicyController>(x => x.M1()); chain.First().ShouldBeOfType <Wrapper>().BehaviorType.ShouldBe(typeof(OPWrapper1)); chain.ToList()[1].ShouldBeOfType <AuthorizationNode>(); }
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.ChainFor<Issue101Endpoint>(x => x.get_hello()); }); }
public void find_by_input_model_and_category_fails_when_there_are_multiple_matching_chains() { var routedChain = graph.ChainFor <ChainResolverController>(x => x.M2(null)) .As <RoutedChain>(); routedChain .UrlCategory.Category = Categories.NEW; graph.ChainFor <ChainResolverController>(x => x.M3(null)) .As <RoutedChain>() .UrlCategory.Category = Categories.NEW; Exception <FubuException> .ShouldBeThrownBy( () => { _resolutionCache.FindUnique(new ChainResolverInput1(), Categories.NEW).FirstCall(); }).ErrorCode .ShouldBe(2108); }
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.ChainFor <Issue101Endpoint>(x => x.get_hello()); }); }
public void SetUp() { container = new Container(); container.Inject(new TransportSettings { DelayMessagePolling = Int32.MaxValue, ListenerCleanupPolling = Int32.MaxValue }); theServiceBus = MockRepository.GenerateMock <IServiceBus>(); var registry = new FubuRegistry(); registry.ServiceBus.Enable(true); registry.Actions.IncludeType <MessageOnePublisher>(); registry.StructureMap(container); registry.AlterSettings <LightningQueueSettings>(x => x.DisableIfNoChannels = true); theRuntime = registry.ToRuntime(); theGraph = theRuntime.Get <BehaviorGraph>(); chain = theGraph.ChainFor <MessageOnePublisher>(x => x.post_message1(null)); container.Inject(theServiceBus); }
private BehaviorChain chainFor(Expression <Action <AuthorizedController2> > action) { return(graph.ChainFor(action)); }
private BehaviorChain chainFor(Expression <Action <AuthorizedByAttributeConventionController> > action) { return(graph.ChainFor(action)); }
public void the_windows_action_call_is_registered() { theGraph.ChainFor <WindowsController>(x => x.Login(null)).ShouldNotBeNull(); }
public void rank_me_last_inputs_should_rank_highly() { _graph.ChainFor <Controller1>(x => x.get_last_ranked(null)) .As <RoutedChain>() .Route.Rank.ShouldBe(int.MaxValue); }
public void should_find_the_IEventPublishers_loaded_into_memory() { chain.ShouldNotBeNull(); theGraph.ChainFor <MessageTwoPublisher>(x => x.post_message2(null)) .ShouldNotBeNull(); }
private IEnumerable <string> rolesFor <T>(Expression <Action <T> > method) { var chain = graph.ChainFor(method); return(chain.Authorization.AllowedRoles()); }
private BehaviorChain chainFor(Expression <Action <JsonOutputAttachmentTesterController> > expression) { return(graph.ChainFor(expression)); }
public void place_no_wrappers_on_actions_that_do_not_have_the_attribute() { graph.ChainFor <WrapWithAttributeController>(x => x.MethodWithNoAttributes()).First() .ShouldNotBeOfType <Wrapper>(); }
public virtual HandlerChain FindChain(Envelope envelope) { var messageType = envelope.Message.GetType(); return(_graph.ChainFor(messageType).As <HandlerChain>()); }
private BehaviorChain chainFor(Expression <Action <Controller1> > method) { return(theGraph.ChainFor(method)); }
public void should_attach_continuation_handlers_to_actions_that_return_an_IRedirectable() { graph.ChainFor <ContinuationHandlerController>(x => x.RedirectedMethod()) .Any(x => x is ContinuationNode) .ShouldBeTrue(); }
public void should_have_imported_the_behavior_chains_without_routes() { graph2.ChainFor <RegistryImportEndpoint>(x => x.GoPartial(null)) .ShouldNotBeNull(); }
public void input_is_first_even_with_authorization() { theGraph.ChainFor <PlacementController>(x => x.post_payload(null)) .Top.ShouldBeOfType <InputNode>() .Next.ShouldBeOfType <AuthorizationNode>(); }
public void SetUp() { container = new Container(); container.Inject(new TransportSettings { DelayMessagePolling = Int32.MaxValue, ListenerCleanupPolling = Int32.MaxValue }); theServiceBus = MockRepository.GenerateMock<IServiceBus>(); var registry = new FubuRegistry(); registry.ServiceBus.Enable(true); registry.Actions.IncludeType<MessageOnePublisher>(); registry.StructureMap(container); registry.AlterSettings<LightningQueueSettings>(x => x.DisableIfNoChannels = true); theRuntime = registry.ToRuntime(); theGraph = theRuntime.Get<BehaviorGraph>(); chain = theGraph.ChainFor<MessageOnePublisher>(x => x.post_message1(null)); container.Inject(theServiceBus); }