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); }
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; }
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 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 void setup() { _handler = new get_Id_handler(null, null); _report = new DebugReport(); _model = getModel(); }