public void DrawTree_SamplesOfTreesDisplayed() { var u = new WorkUnit1A(null); var tree = new WorkUnitTree(u); var paths1 = tree.AddNextNode(new WorkUnitTree(u)) .AddConditionalNodes((i, o) => ExecutionPath.Path1, new Dictionary <ExecutionPath, WorkUnitTree> { [ExecutionPath.Path1] = new WorkUnitTree(u), [ExecutionPath.Path2] = new WorkUnitTree(u), [ExecutionPath.Path3] = new WorkUnitTree(u) }); paths1[ExecutionPath.Path1].AddNextNode(new WorkUnitTree(u)); var path2 = paths1[ExecutionPath.Path2].AddConditionalNodes((i, o) => ExecutionPath.Path2, new Dictionary <ExecutionPath, WorkUnitTree> { [ExecutionPath.Path1] = new WorkUnitTree(u), [ExecutionPath.Path2] = new WorkUnitTree(u) }); path2[ExecutionPath.Path1].AddNextNode(new WorkUnitTree(u)).AddNextNode(new WorkUnitTree(u)).AddNextNode(new WorkUnitTree(u)); path2[ExecutionPath.Path2].AddConditionalNodes((i, o) => ExecutionPath.Path1, new Dictionary <ExecutionPath, WorkUnitTree> { [ExecutionPath.Path1] = new WorkUnitTree(u), [ExecutionPath.Path2] = new WorkUnitTree(u) }); Console.WriteLine("Complete tree:"); Console.WriteLine(tree.DrawTree("")); Console.WriteLine(); Console.WriteLine("Execution path: Path1->Path2"); Console.WriteLine(paths1[ExecutionPath.Path2].DrawTree("")); }
public void DrawTree_DifferentWorkUnitsUsed() { var tree = new WorkUnitTree(new WuRoot()); var paths = tree.AddConditionalNodes(TestWorkUnit.PathSelector, new Dictionary <ExecutionPath, WorkUnitTree> { [ExecutionPath.Path1] = new WorkUnitTree(new Wu1()), [ExecutionPath.Path2] = new WorkUnitTree(new Wu2()), [ExecutionPath.Path3] = new WorkUnitTree(new Wu3()), }); paths[ExecutionPath.Path2].AddNextNode(new WorkUnitTree(new WuA())) .AddNextNode(new WorkUnitTree(new WuB())); Console.WriteLine(tree.DrawTree("")); }