Exemple #1
0
 public bool Equals(BehaviorDetailsModel other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.BehaviorType, BehaviorType));
 }
Exemple #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 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;
        }
 public bool Equals(BehaviorDetailsModel other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.BehaviorType, BehaviorType);
 }