Exemple #1
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));
 }
        public Dictionary <string, object> get_chain_details_Hash(ChainDetailsRequest request)
        {
            var dict = new Dictionary <string, object>();

            var chain = _graph.FindChain(request.Hash);

            if (chain == null)
            {
                dict.Add("not-found", true);
                return(dict);
            }

            dict.Add("details", EndpointReport.ForChain(chain).ToDictionary());

            if (chain is RoutedChain)
            {
                var routed      = chain.As <RoutedChain>();
                var description = Description.For(routed.Route);


                dict.Add("route", description.ToDictionary());
            }

            var nodes = chain.NonDiagnosticNodes().Select(x =>
            {
                var details = x.ToDescriptiveDictionary();
                details.Add("category", x.Category.ToString());


                return(details);
            });

            addPerformanceData(dict, chain);

            dict.Add("nodes", nodes);


            return(dict);
        }
        public Dictionary <string, object> get_chain_details_Hash(ChainDetailsRequest request)
        {
            var dict = new Dictionary <string, object>();

            var chain = _graph.Behaviors.FirstOrDefault(x => x.GetHashCode() == request.Hash);

            if (chain == null)
            {
                dict.Add("not-found", true);
                return(dict);
            }

            dict.Add("details", EndpointReport.ForChain(chain).ToDictionary());

            if (chain is RoutedChain)
            {
                var routed      = chain.As <RoutedChain>();
                var description = Description.For(routed.Route);


                dict.Add("route", new DescriptionBodyTag(description).ToString());
            }

            var nodes = chain.NonDiagnosticNodes().Select(x => {
                return(new Dictionary <string, object>
                {
                    { "title", Description.For(x).Title },
                    { "details", _visualizer.Visualize(x).ToString() },
                    { "category", x.Category.ToString() }
                });
            });

            dict.Add("nodes", nodes);


            return(dict);
        }