當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。