public BehaviorNodeTraceTag(BehaviorNode node, RequestLog log) : base("li")
        {
            var description = Description.For(node);
            AddClass("node-trace").Data("node-id", node.UniqueId.ToString());

            var container = Add("div").AddClass("node-trace-container");
            container.Text(description.Title);

            var start = log.FindStep<BehaviorStart>(x => x.Correlation.Node == node);
            var finish = log.FindStep<BehaviorFinish>(x => x.Correlation.Node == node);

            if (start == null)
            {
                AddClass("gray");
                return;
            }

            var exception = log.FindStep<ExceptionReport>(x => node.UniqueId.Equals(x.CorrelationId));
            if (exception != null || !finish.Log.Succeeded)
            {
                AddClass("exception");
            }

            var duration = finish.RequestTimeInMilliseconds - start.RequestTimeInMilliseconds;

            container.Add("span").Text(duration.ToString() + " ms").AddClass("node-trace-duration");
        }
        public BehaviorNodeTraceTag(BehaviorNode node, RequestLog log) : base("li")
        {
            var description = Description.For(node);

            AddClass("node-trace").Data("node-id", node.UniqueId.ToString());

            var container = Add("div").AddClass("node-trace-container");

            container.Text(description.Title);

            var start  = log.FindStep <BehaviorStart>(x => x.Correlation.Node == node);
            var finish = log.FindStep <BehaviorFinish>(x => x.Correlation.Node == node);

            if (start == null)
            {
                AddClass("gray");
                return;
            }

            // TODO -- What *should* happen here?
            if (finish == null)
            {
                return;
            }

            var exception = log.FindStep <ExceptionReport>(x => node.UniqueId.Equals(x.CorrelationId));

            if (exception != null || !finish.Log.Succeeded)
            {
                AddClass("exception");
            }

            var duration = finish.RequestTimeInMilliseconds - start.RequestTimeInMilliseconds;

            container.Add("span").Text(duration.ToString() + " ms").AddClass("node-trace-duration");
        }
Пример #3
0
        public void find_step_negative()
        {
            var log = new RequestLog();

            log.AddLog(10, new Fake {
                Name = "Jeremy"
            });
            log.AddLog(12, new Fake {
                Name = "Lindsey"
            });
            log.AddLog(13, new Fake {
                Name = "Max"
            });
            log.AddLog(15, new Fake {
                Name = "Shiner"
            });

            log.FindStep <Fake>(x => x.Name == "Josh").ShouldBeNull();
        }
Пример #4
0
        public void find_step_positive()
        {
            var log = new RequestLog();

            log.AddLog(10, new Fake {
                Name = "Jeremy"
            });
            log.AddLog(12, new Fake {
                Name = "Lindsey"
            });
            log.AddLog(13, new Fake {
                Name = "Max"
            });
            log.AddLog(15, new Fake {
                Name = "Shiner"
            });

            var step = log.FindStep <Fake>(x => x.Name == "Shiner");

            step.Log.Name.ShouldEqual("Shiner");
            step.RequestTimeInMilliseconds.ShouldEqual(15);
        }
        public void find_step_positive()
        {
            var log = new RequestLog();
            log.AddLog(10, new Fake{Name = "Jeremy"});
            log.AddLog(12, new Fake{Name = "Lindsey"});
            log.AddLog(13, new Fake{Name = "Max"});
            log.AddLog(15, new Fake{Name = "Shiner"});

            var step = log.FindStep<Fake>(x => x.Name == "Shiner");
            step.Log.Name.ShouldEqual("Shiner");
            step.RequestTimeInMilliseconds.ShouldEqual(15);
        }
        public void find_step_negative()
        {
            var log = new RequestLog();
            log.AddLog(10, new Fake { Name = "Jeremy" });
            log.AddLog(12, new Fake { Name = "Lindsey" });
            log.AddLog(13, new Fake { Name = "Max" });
            log.AddLog(15, new Fake { Name = "Shiner" });

            log.FindStep<Fake>(x => x.Name == "Josh").ShouldBeNull();
        }