예제 #1
0
        public void negative_case()
        {
            var chain = new BehaviorChain();
            chain.IsPartialOnly = false;

            new IsPartial().Matches(chain).ShouldBeFalse();  
        }
예제 #2
0
 public void VisitBehavior(BehaviorChain chain)
 {
     if (_filters.MatchesAll(chain))
     {
         _actions.Do(chain);
     }
 }
        protected override DoNext applyOutputs(IOutputNode node, BehaviorChain chain, ConnegSettings settings)
        {
            var graph = settings.Graph ?? new ConnegGraph();
            graph.WriterTypesFor(node.ResourceType).Each(type => node.Add((IMediaWriter) Activator.CreateInstance(type)));

            return DoNext.Continue;
        }
        protected override DoNext applyInputs(IInputNode node, BehaviorChain chain, ConnegSettings settings)
        {
            var graph = settings.Graph ?? new ConnegGraph();
            graph.ReaderTypesFor(node.InputType()).Each(type => node.Add(Activator.CreateInstance((Type) type).As<IReader>()));

            return DoNext.Continue;
        }
		public bool Matches(BehaviorChain chain)
		{
			var call = chain.FirstCall();
			if (call == null) return true;

			return !call.HasAttribute<NotValidatedAttribute>() && !call.InputType().HasAttribute<NotValidatedAttribute>();
		}
        public static string TitleForChain(BehaviorChain chain)
        {
            if (chain.GetRoutePattern().IsNotEmpty())
            {
                return chain.GetRoutePattern();
            }

            if (chain.GetRoutePattern() == string.Empty)
            {
                return "(home)";
            }

            if (chain.Calls.Any())
            {
                return chain.Calls.Select(x => x.Description).Join(", ");
            }

            if (chain.HasOutput() && chain.Output.Writers.Any())
            {
                return chain.Output.Writers.Select(x => Description.For(x).Title).Join(", ");
            }

            if (chain.InputType() != null)
            {
                return "Handler for " + chain.InputType().FullName;
            }

            return "BehaviorChain " + chain.UniqueId;
        }
예제 #7
0
        public bool Matches(BehaviorChain chain)
        {
            var call = chain.Calls.LastOrDefault();
            if (call == null) return false;

            return _filter(call);
        }
예제 #8
0
        public void Apply(BehaviorGraph graph, BehaviorChain chain)
        {
            // Don't override the route if it already exists
            if (chain.Route != null)
            {
                return;
            }

            // Don't override the route if the chain is a partial
            if (chain.IsPartialOnly)
            {
                return;
            }

            _observer = graph.Observer;

            ActionCall call = chain.Calls.FirstOrDefault();
            if (call == null) return;

            IUrlPolicy policy = _policies.FirstOrDefault(x => x.Matches(call, _observer)) ?? _defaultUrlPolicy;
            _observer.RecordCallStatus(call, "First matching UrlPolicy (or default): {0}".ToFormat(policy.GetType().Name));

            IRouteDefinition route = policy.Build(call);
            _constraintPolicy.Apply(call, route, _observer);

            _observer.RecordCallStatus(call, "Route definition determined by url policy: [{0}]".ToFormat(route.ToRoute().Url));
            chain.Route = route;
        }
        public static bool ShouldApply(BehaviorChain chain)
        {
            // TODO -- Get the BehaviorChainFilter thing going again?
            if ( (chain.GetRoutePattern() ?? string.Empty).Contains(DiagnosticUrlPolicy.DIAGNOSTICS_URL_ROOT) )
            {
                return false;
            }            

            if (chain.Calls.Any(x => x.HandlerType.Assembly == DiagnosticAssembly))
            {
                return false;
            }

            if (chain.Calls.Any(x => x.HasAttribute<NoDiagnosticsAttribute>()))
            {
                return false;
            }

            if (chain.InputType() != null && chain.InputType().Assembly == DiagnosticAssembly)
            {
                return false;
            }

            if (chain.ResourceType() != null && chain.ResourceType().Assembly == DiagnosticAssembly)
            {
                return false;
            }

            return true;
        }
예제 #10
0
        public void positive_case()
        {
            var chain = new BehaviorChain();
            chain.IsPartialOnly = true;

            new IsPartial().Matches(chain).ShouldBeTrue();
        }
        public static bool IsNotDiagnosticRoute(BehaviorChain chain)
        {
            if (chain is DiagnosticChain) return false;


            if (chain.Calls.Any(x => x.HandlerType.Assembly == Assembly.GetExecutingAssembly()))
            {
                return false;
            }

            if (chain.Calls.Any(x => x.HasInput && x.InputType().Assembly == Assembly.GetExecutingAssembly()))
            {
                return false;
            }

            if (chain.HasOutput() && chain.ResourceType().Assembly == Assembly.GetExecutingAssembly())
            {
                return false;
            }

            if (chain.HasOutput())
            {
                if (chain.Output.Writers.OfType<ViewNode>().Any(x => x.View.Namespace.Contains("Visualization.Visualizers")))
                {
                    return false;
                }
            }

            return true;
        }
예제 #12
0
        public void Apply(BehaviorGraph graph, BehaviorChain chain)
        {
            // Don't override the route if it already exists
            if (chain.Route != null)
            {
                return;
            }

            // Don't override the route if the chain is a partial
            if (chain.IsPartialOnly)
            {
                return;
            }

            var call = chain.Calls.FirstOrDefault();
            if (call == null) return;

            var policy = _policies.FirstOrDefault(x => x.Matches(call)) ?? _defaultUrlPolicy;

            call.Trace("First matching UrlPolicy (or default): {0}", policy.GetType().Name);

            var route = policy.Build(call);
            _constraintPolicy.Apply(call, route);

            route.Trace("Route definition determined by url policy: [{0}]", route.ToRoute().Url);

            chain.Route = route;
        }
예제 #13
0
        public bool Matches(BehaviorChain chain)
        {
            if (chain.Route == null) return false;
            if (chain.IsPartialOnly) return false;

            return chain.Route.RespondsToMethod(_method);
        }
        public static bool IsNotDiagnosticRoute(BehaviorChain chain)
        {
            if (chain is DiagnosticChain) return false;
            if (chain.Tags.Contains("Diagnostics")) return false;

            return true;
        }
예제 #15
0
        static ClassBehavior GetInnermostBehavior(Configuration config, BehaviorChain<Fixture> fixtureBehaviors)
        {
            if (config.ConstructionFrequency == ConstructionFrequency.PerCase)
                return new CreateInstancePerCase(config.TestClassFactory, fixtureBehaviors);

            return new CreateInstancePerClass(config.TestClassFactory, fixtureBehaviors);
        }
예제 #16
0
 public string Text(BehaviorChain chain)
 {
     if (chain.Route == null) return " -";
     var httpMethodConstraint = chain.Route.Constraints.Where(kv => kv.Key == RouteConstraintPolicy.HTTP_METHOD_CONSTRAINT).Select(kv => kv.Value).FirstOrDefault() as HttpMethodConstraint;
     var methodList = httpMethodConstraint == null ? string.Empty : "[" + httpMethodConstraint.AllowedMethods.Join(",") + "] ";
     return methodList + chain.Route.Pattern;
 }
        public void do_nothing_if_tracing_is_off()
        {
            var registry = new FubuRegistry();
            registry.AlterSettings<DiagnosticsSettings>(x => x.TraceLevel = TraceLevel.None);
            registry.Configure(graph =>
            {
                chain1 = new BehaviorChain();
                chain1.AddToEnd(Wrapper.For<SimpleBehavior>());
                chain1.AddToEnd(Wrapper.For<DifferentBehavior>());
                chain1.Route = new RouteDefinition("something");
                graph.AddChain(chain1);

                chain2 = new BehaviorChain();
                chain2.IsPartialOnly = true;
                chain2.AddToEnd(Wrapper.For<SimpleBehavior>());
                chain2.AddToEnd(Wrapper.For<DifferentBehavior>());
                graph.AddChain(chain2);
            });


            registry.Policies.Add<ApplyTracing>();

            var notTracedGraph = BehaviorGraph.BuildFrom(registry);
            notTracedGraph.Behaviors.SelectMany(x => x).Any(x => x is DiagnosticBehavior).ShouldBeFalse();
            notTracedGraph.Behaviors.SelectMany(x => x).Any(x => x is BehaviorTracer).ShouldBeFalse();
        }
예제 #18
0
        public void SetUp()
        {
            theChain = new BehaviorChain(){
                Route = new RouteDefinition("some/pattern/url")
            };

            theSecondChain = new BehaviorChain()
            {
                Route = new RouteDefinition("some/other/pattern")
            };

            theThirdChain = new BehaviorChain()
            {
                Route = new RouteDefinition("yet/another/pattern")
            };

            theRouteData = new Dictionary<string, object>{
                {"A", "1"},
                {"B", "2"},
                {"C", "3"}
            };

            someDifferentRouteData = new Dictionary<string, object>{
                {"A", "1"},
                {"B", "2"},
                {"C", "33"}
            };
        }
예제 #19
0
 public ExecutionPlan(Configuration config)
 {
     classBehaviors =
         BuildClassBehaviorChain(config,
             BuildFixtureBehaviorChain(config,
                 BuildCaseBehaviorChain(config)));
 }
        protected override DoNext applyOutputs(IOutputNode node, BehaviorChain chain, ConnegSettings settings)
        {
            node.Add(settings.FormatterFor(MimeType.Json));
            node.Add(settings.FormatterFor(MimeType.Xml));

            return DoNext.Continue;
        }
예제 #21
0
 public void VisitRoute(IRouteDefinition route, BehaviorChain chain)
 {
     if (_behaviorFilters.MatchesAll(chain) && _routeFilters.MatchesAll(route))
     {
         _actions.Do(route, chain);
     }
 }
예제 #22
0
        public void matches_negative()
        {
            var chain = new BehaviorChain();
            chain.AddToEnd(ActionCall.For<SomeEndpoints>(x => x.post_no_interface(null)));

            new InputTypeImplements<ISomeInterface>()
                .Matches(chain).ShouldBeFalse();
        }
 private static void scanChain(BehaviorChain chain)
 {
     chain.Calls
         .SelectMany(x => x.Method.GetAllAttributes<WrapWithAttribute>())
         .SelectMany(x => x.BehaviorTypes.Select(t => new Wrapper(t)))
         .Reverse()
         .Each(chain.Prepend);
 }
        public void automatically_excludes_the_NotAuthenticated_attribute()
        {
            var chain = new BehaviorChain();
            chain.AddToEnd(ActionCall.For<AuthenticatedEndpoints>(x => x.get_notauthenticated()));

            new AuthenticationSettings().ShouldBeExcluded(chain)
                .ShouldBeTrue();
        }
        protected override DoNext applyInputs(IInputNode node, BehaviorChain chain, ConnegSettings settings)
        {
            node.Add(typeof(ModelBindingReader<>));
            node.Add(settings.FormatterFor(MimeType.Json));
            node.Add(settings.FormatterFor(MimeType.Xml));

            return DoNext.Continue;
        }
예제 #26
0
 public void SetUp()
 {
     theChain = new BehaviorChain();
     theRoutedChain = new RoutedChain("something");
     theUrls = new StubUrlRegistry();
     _report = new Lazy<EndpointReport>(() => EndpointReport.ForChain(theChain));
     _routedReport = new Lazy<EndpointReport>(() => EndpointReport.ForChain(theRoutedChain));
 }
예제 #27
0
        public void does_not_blow_up_if_there_is_no_input_type()
        {
            var chain = new BehaviorChain();
            chain.AddToEnd(ActionCall.For<SomeEndpoints>(x => x.get_interface()));

            new InputTypeImplements<ISomeInterface>()
                .Matches(chain).ShouldBeFalse();
        }
        public void SetUp()
        {
            theChain = new BehaviorChain();
            var action = ActionCall.For<Controller1>(x => x.Go(null));
            theChain.AddToEnd(action);

            theOriginalGuid = action.UniqueId;
        }
예제 #29
0
        public void matches_negative_with_one_action()
        {
            var chain = new BehaviorChain();
            chain.AddToEnd(ActionCall.For<ActionEndpoint>(x => x.get_hello()));

            var match = new LastActionMatch(call => call.Method.Name.EndsWith("HTML"));
            match.Matches(chain).ShouldBeFalse();
        }
예제 #30
0
        public void matches_positive_with_one_action()
        {
            var chain = new BehaviorChain();
            chain.AddToEnd(ActionCall.For<ActionEndpoint>(x => x.SaySomethingHTML()));

            var match = new LastActionMatch(call => call.Method.Name.EndsWith("HTML"));
            match.Matches(chain).ShouldBeTrue();
        }
예제 #31
0
        public void SetUp()
        {
            chain = new BehaviorChain();

            var node = new AuthorizationNode();

            node.AddRole("RoleA");
            node.AddRole("RoleB");
            node.AddRole("RoleC");

            chain.AddToEnd(node);

            endpointObjectDef = node.As <IAuthorizationRegistration>().ToEndpointAuthorizorObjectDef();
        }
예제 #32
0
        public BehaviorChain BehaviorFor(IRouteDefinition route)
        {
            var chain = _behaviors.FirstOrDefault(x => x.Route == route);

            if (chain == null)
            {
                chain = new BehaviorChain {
                    Route = route
                };
                _behaviors.Fill(chain);
            }

            return(chain);
        }
        protected override void theContextIs()
        {
            partial = MockRepository.GenerateMock <IActionBehavior>();



            input    = new InputModel();
            theChain = new BehaviorChain();
            MockFor <IChainResolver>().Stub(x => x.FindUnique(input)).Return(theChain);

            MockFor <IPartialFactory>().Expect(x => x.BuildBehavior(theChain)).Return(partial);

            ProcessContinuation(FubuContinuation.TransferTo(input));
        }
예제 #34
0
        public void prepend_with_an_existing_top_behavior()
        {
            var chain = new BehaviorChain();
            var call  = ActionCall.For <TestController>(x => x.AnotherAction(null));

            chain.AddToEnd(call);

            var wrapper = new Wrapper(typeof(FakeJsonBehavior));

            chain.Prepend(wrapper);

            chain.Top.ShouldBeTheSameAs(wrapper);
            wrapper.Next.ShouldBeTheSameAs(call);
        }
예제 #35
0
        public void SetUp()
        {
            theChain = new BehaviorChain();

            node1 = new StubNode();
            node2 = new StubNode();
            node3 = new StubNode();

            theChain.AddToEnd(node1);
            theChain.AddToEnd(node2);
            theChain.AddToEnd(node3);

            theChain.ShouldHaveTheSameElementsAs(node1, node2, node3);
        }
예제 #36
0
        public void SetUp()
        {
            theViews = new List <IViewToken>();
            for (int i = 0; i < 15; i++)
            {
                theViews.Add(MockRepository.GenerateMock <ITemplateFile>());
            }

            theAction = ActionCall.For <GoController>(x => x.Go());
            theChain  = new BehaviorChain();
            theChain.AddToEnd(theAction);

            thePolicy = new ViewAttachmentPolicy();
        }
예제 #37
0
파일: ConfigLog.cs 프로젝트: moacap/fubumvc
        public IEnumerable <ITracedModel> TracedModelsFor(BehaviorChain chain)
        {
            yield return(chain);

            if (chain.Route != null)
            {
                yield return((ITracedModel)chain.Route);
            }

            foreach (var node in chain)
            {
                yield return(node);
            }
        }
예제 #38
0
        public static Task <R> QueryWitTimeoutAsync <T, R>
        (
            this IEventAggregator eventAggregate,
            T message,
            TimeSpan?timeout,
            RoutingFilter filter = null,
            CancellationToken cancellationToken = default

        ) where R : class
        {
            var chain = new BehaviorChain().WithTimeout(timeout);

            return(eventAggregate.QueryAsync <T, R>(message, filter, cancellationToken, chain));
        }
예제 #39
0
        public void uses_the_first_may_have_input_with_non_null()
        {
            var chain = new BehaviorChain();

            chain.AddToEnd(new FakeInputNode(typeof(string)));

            chain.InputType().ShouldEqual(typeof(string));

            chain.Prepend(new FakeInputNode(null));
            chain.InputType().ShouldEqual(typeof(string));

            chain.Prepend(new FakeInputNode(typeof(int)));
            chain.InputType().ShouldEqual(typeof(int));
        }
예제 #40
0
        public static void Modify(BehaviorChain chain)
        {
            // Not everything is hard
            chain.Output.Remove();

            if (chain.OfType <InputNode>().Any())
            {
                chain.Input.AddAfter(chain.Output);
            }
            else
            {
                chain.FirstCall().AddBefore(chain.Output);
            }
        }
예제 #41
0
        public void write_route_column_when_the_route_exists()
        {
            var chain = new BehaviorChain();

            chain.Route = new RouteDefinition("some/thing/else");

            var row = new TableRowTag();
            var tag = row.Cell();

            new RouteColumn().WriteBody(chain, null, tag);

            tag.FirstChild().Text().ShouldEqual(chain.Route.Pattern);
            row.HasClass(BehaviorGraphWriter.FUBU_INTERNAL_CLASS).ShouldBeFalse();
        }
        public void adds_validation_action_filter_for_lofi_endpoints()
        {
            var call = ActionCall.For <SampleInputModel>(x => x.Test(null));

            var chain = new BehaviorChain();

            chain.AddToEnd(call);

            ValidationPolicy.ApplyValidation(call, new ValidationSettings());

            var nodes = chain.ToArray();
            var node  = nodes[0].As <IHaveValidation>();

            node.As <ActionFilter>().HandlerType.ShouldBe(typeof(ValidationActionFilter <string>));
        }
        public void adds_ajax_validation_action_filter_for_ajax_endpoints()
        {
            var call = ActionCall.For <SampleAjaxModel>(x => x.post_model(null));

            var chain = new BehaviorChain();

            chain.AddToEnd(call);

            ValidationPolicy.ApplyValidation(call, new ValidationSettings());

            var nodes = chain.ToArray();
            var node  = nodes[0].As <IHaveValidation>();

            node.ShouldBeOfType <AjaxValidationNode>();
        }
        public static void MakeAsymmetricJson(this BehaviorChain chain)
        {
            if (chain.InputType() != null)
            {
                chain.Input.ClearAll();
                chain.Input.AllowHttpFormPosts = true;
                chain.Input.AddFormatter <JsonFormatter>();
            }

            if (chain.ResourceType() != null)
            {
                chain.Output.ClearAll();
                chain.Output.AddFormatter <JsonFormatter>();
            }
        }
예제 #45
0
        public void SetUp()
        {
            theHttpRequest = new StandInCurrentHttpRequest();
            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));
        }
예제 #46
0
        public void Resolve(IChainResolver resolver)
        {
            if (_finder == null)
            {
                return;
            }

            _chain = _finder(resolver);


            if (_chain == null)
            {
                throw new InvalidOperationException("Unable to find the requested behavior chain for menu " + Key);
            }
        }
예제 #47
0
        public BehaviorOutlineTag(BehaviorChain chain)
        {
            AddHeader("Behaviors");

            if (chain.Route != null)
            {
                AddNode("Route", ChainVisualization.RouteDescId);
            }

            chain.NonDiagnosticNodes().Each(x =>
            {
                var description = Description.For(x);
                AddNode(description.Title, x.UniqueId.ToString());
            });
        }
예제 #48
0
        public void hash_values_when_the_chain_has_a_route_but_not_real_values()
        {
            var chain = new BehaviorChain()
            {
                Route = new RouteDefinition("some/pattern/url")
            };

            var currentChain = new CurrentChain(chain, new Dictionary <string, object>());

            var varyBy = new VaryByResource(currentChain);

            var values = varyBy.Values();

            values.Select(x => "{0}={1}".ToFormat(x.Key, x.Value)).ShouldHaveTheSameElementsAs("chain=" + chain.UniqueId.ToString());
        }
예제 #49
0
        protected override void beforeEach()
        {
            theInput  = new PartialInputModel();
            theAction = MockFor <IActionBehavior>();

            MockFor <IFubuRequest>().Stub(x => x.Get <PartialInputModel>()).Return(theInput);
            MockFor <IAuthorizationPreviewService>().Expect(x => x.IsAuthorized(theInput)).Return(false);

            theChain = new BehaviorChain();
            MockFor <IRecordedOutput>().Stub(x => x.Headers()).Return(Enumerable.Empty <Header>());

            MockFor <IPartialFactory>().Stub(x => x.BuildPartial(theChain)).Return(theAction);

            theOutput = ClassUnderTest.InvokeObject(theInput);
        }
예제 #50
0
        public static Task <R> QueryAsync <T, R>
        (
            this IEventAggregator eventAggregate,
            T message,
            RoutingFilter filter = null,
            CancellationToken cancellationToken = default,
            TimeSpan?timeout = null,
            int retryCount   = 0,
            bool async       = false
        ) where R : class
        {
            var chain = new BehaviorChain().WithTimeout(timeout).WithRetry(retryCount).WithAsync(async);

            return(eventAggregate.QueryAsync <T, R>(message, filter, cancellationToken, chain));
        }
예제 #51
0
        public void apply_a_custom_exclusion()
        {
            var chain = new BehaviorChain();

            chain.AddToEnd(ActionCall.For <AuthenticatedEndpoints>(x => x.get_tag()));


            var settings = new AuthenticationSettings();

            settings.ShouldBeExcluded(chain).ShouldBeFalse();

            settings.ExcludeChains.ResourceTypeIs <HtmlTag>();

            settings.ShouldBeExcluded(chain).ShouldBeTrue();
        }
예제 #52
0
        public void write_with_a_single_output()
        {
            var chain = new BehaviorChain();
            var node  = new OutputNode(typeof(RouteParameter));

            chain.AddToEnd(node);

            var tag = new HtmlTag("td");

            var column = new OutputColumn();

            column.WriteBody(chain, null, tag);

            tag.Text().ShouldEqual(node.Description);
        }
예제 #53
0
        protected override void beforeEach()
        {
            theInput  = new PartialInputModel();
            theAction = MockFor <IActionBehavior>();

            MockFor <IFubuRequest>().Stub(x => x.Get <PartialInputModel>()).Return(theInput);
            MockFor <IAuthorizationPreviewService>().Expect(x => x.IsAuthorized(theInput)).Return(false);

            theChain = new BehaviorChain();
            MockFor <IChainResolver>().Stub(x => x.FindUniqueByType(typeof(PartialInputModel))).Return(theChain);

            MockFor <IPartialFactory>().Stub(x => x.BuildPartial(theChain)).Return(theAction);

            theOutput = ClassUnderTest.Invoke <PartialInputModel>();
        }
예제 #54
0
        public void forward_the_chain()
        {
            var model2 = new Model2();


            var forwarder = new ChainForwarder <Model1>(m1 => model2);

            var resolver = MockRepository.GenerateMock <IChainResolver>();
            var chain    = new BehaviorChain();


            resolver.Expect(x => x.FindUnique(model2)).Return(chain);

            forwarder.FindChain(resolver, new Model1()).ShouldBeTheSameAs(chain);
        }
예제 #55
0
        private void addPerformanceData(Dictionary <string, object> dict, BehaviorChain chain)
        {
            dict.Add("performance", chain.Performance.ToDictionary());

            var recent     = _history.GetRecentRequests(chain).OrderByDescending(x => x.Time);
            var executions = recent.Select(log =>
            {
                var logDict = log.ToHeaderDictionary();
                logDict.Add("warn", chain.Performance.IsWarning(log));

                return(logDict);
            }).ToArray();

            dict.Add("executions", executions);
        }
예제 #56
0
        public void Alter(BehaviorChain chain)
        {
            var node = chain.OfType <OutputCachingNode>().FirstOrDefault();

            if (node == null)
            {
                node = new OutputCachingNode();
                chain.AddToEnd(node);
            }

            if (_varyBy != null)
            {
                node.ReplaceVaryByRules(_varyBy);
            }
        }
예제 #57
0
        public void SetUp()
        {
            theFactory = MockRepository.GenerateMock <IServiceFactory>();
            theChain   = new RoutedChain("something");

            theRouteData = new Dictionary <string, object>();

            theArguments = new TypeArguments();
            theBehavior  = MockRepository.GenerateMock <IActionBehavior>();

            theFactory.Stub(x => x.BuildBehavior(theArguments, theChain.UniqueId))
            .Return(theBehavior);

            theInvoker = new BehaviorInvoker(theFactory, theChain);
        }
예제 #58
0
        public void write_body_cell_with_only_one_call()
        {
            var        chain = new BehaviorChain();
            ActionCall call  = ActionCall.For <TargetController>(x => x.Go());

            chain.AddToEnd(call);

            var column = new ActionColumn();

            var tag = new HtmlTag("td");

            column.WriteBody(chain, null, tag);

            tag.Text().ShouldEqual(call.Description);
        }
        public void create_by_creator_of()
        {
            var key  = StringToken.FromKeyString("Something");
            var node = MenuNode.ForCreatorOf(key, typeof(Address));


            var chain = new BehaviorChain();

            chain.UrlCategory.Creates.Add(typeof(Address));

            resolve(node, graph => graph.AddChain(chain));


            node.BehaviorChain.ShouldBeTheSameAs(chain);
        }
예제 #60
0
        public void for_an_input_type()
        {
            BehaviorChain chain1 = BehaviorChain.For <ControllerTarget>(x => x.OneInOneOut(null));

            graph.AddChain(chain1);

            var behavior = MockRepository.GenerateMock <IActionBehavior>();

            MockFor <IBehaviorFactory>()
            .Stub(x => x.BuildBehavior(args, chain1.UniqueId))
            .Return(behavior);

            ClassUnderTest.BuildPartial(typeof(Model1))
            .ShouldBeTheSameAs(behavior);
        }