Example #1
0
        public BehaviorDetailsModel Gather(IDebugReport report)
        {
            // TODO -- come back and clean this up. Just getting it up and running for a demo
            BehaviorDetailsModel root = null;
            var behaviors             = new Cache <Type, BehaviorDetailsModel>(t =>
            {
                var model = new BehaviorDetailsModel {
                    BehaviorType = t
                };
                if (root == null)
                {
                    root = model;
                }

                return(model);
            });
            Type lastBehaviorType = null;

            report
            .Steps
            .Each(s =>
            {
                var behaviorType     = s.Behavior.BehaviorType;
                var isSameBehavior   = behaviorType == lastBehaviorType;
                var isBehaviorFinish = s.Details.GetType().CanBeCastTo <BehaviorFinish>();

                if (behaviors.Has(behaviorType) && (!isSameBehavior || isBehaviorFinish))
                {
                    behaviors[behaviorType].AddAfter(s.Details);
                }
                else
                {
                    behaviors[behaviorType].AddBefore(s.Details);
                }

                var currentBehavior = behaviors[behaviorType];
                currentBehavior.Id  = s.Behavior.BehaviorId;

                if (lastBehaviorType != null && !isSameBehavior && isBehaviorFinish)
                {
                    var lastBehavior = behaviors[lastBehaviorType];
                    if (!lastBehavior.Equals(root))
                    {
                        currentBehavior.Inner = lastBehavior;
                    }
                }

                lastBehaviorType = behaviorType;
            });

            return(root);
        }
Example #2
0
        public BehaviorDetailsModel Gather(IDebugReport report)
        {
            // TODO -- come back and clean this up. Just getting it up and running for a demo
            BehaviorDetailsModel root = null;
            var behaviors = new Cache<Type, BehaviorDetailsModel>(t =>
                                                                  	{
                                                                  		var model = new BehaviorDetailsModel {BehaviorType = t};
                                                                        if(root == null)
                                                                        {
                                                                            root = model;
                                                                        }

                                                                  		return model;
                                                                  	});
            Type lastBehaviorType = null;
            report
                .Steps
                .Each(s =>
                      	{
                      		var behaviorType = s.Behavior.BehaviorType;
                      	    var isSameBehavior = behaviorType == lastBehaviorType;
                      	    var isBehaviorFinish = s.Details.GetType().CanBeCastTo<BehaviorFinish>();

                            if (behaviors.Has(behaviorType) && (!isSameBehavior || isBehaviorFinish))
                            {
                                behaviors[behaviorType].AddAfter(s.Details);
                            }
                            else
                            {
                                behaviors[behaviorType].AddBefore(s.Details);
                            }

                            var currentBehavior = behaviors[behaviorType];
                      	    currentBehavior.Id = s.Behavior.BehaviorId;

                            if (lastBehaviorType != null && !isSameBehavior && isBehaviorFinish)
                            {
                                var lastBehavior = behaviors[lastBehaviorType];
                                if(!lastBehavior.Equals(root))
                                {
                                    currentBehavior.Inner = lastBehavior;
                                }
                            }

                            lastBehaviorType = behaviorType;
                      	});

            return root;
        }
Example #3
0
        public BehaviorDetailsModel Gather(IDebugReport report)
        {
            // TODO -- come back and clean this up. Just getting it up and running for a demo
            BehaviorDetailsModel root = null;
            var behaviors             = new Cache <Type, BehaviorDetailsModel>(t =>
            {
                var model = new BehaviorDetailsModel {
                    BehaviorType = t
                };
                if (root == null)
                {
                    root = model;
                }

                return(model);
            });
            Type lastBehavior = null;

            report
            .Steps
            .Each(s =>
            {
                var behaviorType = s.Behavior.BehaviorType;
                if (behaviors.Has(behaviorType) && behaviorType != lastBehavior)
                {
                    behaviors[behaviorType].AddAfter(s.Details);
                }
                else
                {
                    behaviors[behaviorType].AddBefore(s.Details);
                }

                if (lastBehavior != null && behaviorType != lastBehavior)
                {
                    var lastModel = behaviors[lastBehavior];
                    if (!lastModel.Equals(root))
                    {
                        behaviors[behaviorType].Inner = lastModel;
                    }
                }

                lastBehavior = behaviorType;
            });

            return(root);
        }
Example #4
0
        public BehaviorDetailsModel Gather(IDebugReport report)
        {
            // TODO -- come back and clean this up. Just getting it up and running for a demo
            BehaviorDetailsModel root = null;
            var behaviors = new Cache<Type, BehaviorDetailsModel>(t =>
                                                                  	{
                                                                  		var model = new BehaviorDetailsModel {BehaviorType = t};
                                                                        if(root == null)
                                                                        {
                                                                            root = model;
                                                                        }

                                                                  		return model;
                                                                  	});
            Type lastBehavior = null;
            report
                .Steps
                .Each(s =>
                      	{
                      		var behaviorType = s.Behavior.BehaviorType;
                            if(behaviors.Has(behaviorType) && behaviorType != lastBehavior)
                            {
                                behaviors[behaviorType].AddAfter(s.Details);
                            }
                            else
                            {
                                behaviors[behaviorType].AddBefore(s.Details);
                            }

                            if(lastBehavior != null && behaviorType != lastBehavior)
                            {
                                var lastModel = behaviors[lastBehavior];
                                if(!lastModel.Equals(root))
                                {
                                    behaviors[behaviorType].Inner = lastModel;
                                }
                            }

                            lastBehavior = behaviorType;
                      	});

            return root;
        }
Example #5
0
 public void setup()
 {
     _handler = new get_Id_handler(null, null);
     _report  = new DebugReport();
     _model   = getModel();
 }