Created
March 29, 2011 17:26
-
-
Save jmarnold/892813 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) | |
{ | |
behaviors[lastBehavior].Inner = behaviors[behaviorType]; | |
} | |
lastBehavior = behaviorType; | |
}); | |
return root; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment