当前位置: 首页>>代码示例>>C#>>正文


C# BehaviorChain类代码示例

本文整理汇总了C#中BehaviorChain的典型用法代码示例。如果您正苦于以下问题:C# BehaviorChain类的具体用法?C# BehaviorChain怎么用?C# BehaviorChain使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BehaviorChain类属于命名空间,在下文中一共展示了BehaviorChain类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Matches

        public bool Matches(BehaviorChain chain)
        {
            if (chain.Route == null) return false;
            if (chain.IsPartialOnly) return false;

            return chain.Route.RespondsToMethod(_method);
        }
开发者ID:NeilSorensen,项目名称:fubumvc,代码行数:7,代码来源:HttpMethodFilter.cs

示例2: do_nothing_if_tracing_is_off

        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();
        }
开发者ID:DarthFubuMVC,项目名称:FubuMVC.Diagnostics,代码行数:26,代码来源:ApplyTracingIntegrationTesting.cs

示例3: ShouldApply

        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;
        }
开发者ID:JordanZaerr,项目名称:FubuMVC.Diagnostics,代码行数:30,代码来源:ApplyTracing.cs

示例4: SetUp

        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"}
            };
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:28,代码来源:CurrentChainTester.cs

示例5: IsNotDiagnosticRoute

        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;
        }
开发者ID:DarthFubuMVC,项目名称:FubuMVC.Diagnostics,代码行数:30,代码来源:EndpointExplorerFubuDiagnostics.cs

示例6: applyOutputs

        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;
        }
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:7,代码来源:CustomReadersAndWriters.cs

示例7: applyInputs

        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;
        }
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:7,代码来源:CustomReadersAndWriters.cs

示例8: IsNotDiagnosticRoute

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

            return true;
        }
开发者ID:jbogard,项目名称:fubumvc,代码行数:7,代码来源:EndpointExplorerFubuDiagnostics.cs

示例9: VisitRoute

 public void VisitRoute(IRouteDefinition route, BehaviorChain chain)
 {
     if (_behaviorFilters.MatchesAll(chain) && _routeFilters.MatchesAll(route))
     {
         _actions.Do(route, chain);
     }
 }
开发者ID:bbehrens,项目名称:fubumvc,代码行数:7,代码来源:RouteVisitor.cs

示例10: TitleForChain

        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;
        }
开发者ID:RyanHauert,项目名称:FubuMVC.Diagnostics,代码行数:29,代码来源:ChainVisualization.cs

示例11: ExecutionPlan

 public ExecutionPlan(Configuration config)
 {
     classBehaviors =
         BuildClassBehaviorChain(config,
             BuildFixtureBehaviorChain(config,
                 BuildCaseBehaviorChain(config)));
 }
开发者ID:JakeGinnivan,项目名称:fixie,代码行数:7,代码来源:ExecutionPlan.cs

示例12: Matches

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

			return !call.HasAttribute<NotValidatedAttribute>() && !call.InputType().HasAttribute<NotValidatedAttribute>();
		}
开发者ID:stevematney,项目名称:fubuvalidation,代码行数:7,代码来源:NotValidatedAttributeFilter.cs

示例13: GetInnermostBehavior

        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);
        }
开发者ID:JakeGinnivan,项目名称:fixie,代码行数:7,代码来源:ExecutionPlan.cs

示例14: applyOutputs

        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;
        }
开发者ID:cothienlac86,项目名称:fubumvc,代码行数:7,代码来源:DefaultReadersAndWriters.cs

示例15: VisitBehavior

 public void VisitBehavior(BehaviorChain chain)
 {
     if (_filters.MatchesAll(chain))
     {
         _actions.Do(chain);
     }
 }
开发者ID:bbehrens,项目名称:fubumvc,代码行数:7,代码来源:BehaviorVisitor.cs


注:本文中的BehaviorChain类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。