public void Test_GetWorkflowHistory_TwoLevel() { // Testing an ideal 6 item Workflow history "tree" var pRoot = new Procedure(); // associative Procedure to first level var ps1 = new ConcreteProcedureStep(pRoot); // First level var p1 = new Procedure(); // associative Procedure to left branch of second level var ps11 = new ConcreteProcedureStep(p1); // Second level, left branch var ps12 = new ConcreteProcedureStep(p1); // Second level, left branch ps11.AddRelatedStep(ps12); // Relate children ps1.LinkTo(ps11); // Link adjacent levels var ps2 = new ConcreteProcedureStep(pRoot); // First level var p2 = new Procedure(); // associative Procedure to right branch of second level var ps21 = new ConcreteProcedureStep(p2); // Second level, right branch var ps22 = new ConcreteProcedureStep(p2); // Second level, right branch ps21.AddRelatedStep(ps22); // Relate children ps2.LinkTo(ps21); // Link adjacent levels Assert.AreEqual(6, pRoot.GetWorkflowHistory().Count); // Assert all items in "tree" are present in Workflow history }
public void Test_GetWorkflowHistory_UnrelatedSteps() { // This "tree" doesn't have the right children of each pair in the third level // Due to the abscence of relating these steps var pRoot = new Procedure(); // associative Procedure to first level var ps1 = new ConcreteProcedureStep(pRoot); var p1 = new Procedure(); // associative Procedure to left branch of second level var ps11 = new ConcreteProcedureStep(p1); var p11 = new Procedure(); // associative Procedure to leftmost branch of third level var ps111 = new ConcreteProcedureStep(p11); var ps112 = new ConcreteProcedureStep(p11); // is not related to ps111 ps11.LinkTo(ps111); // link adjacent levels var ps12 = new ConcreteProcedureStep(p1); var p12 = new Procedure(); // associative Procedure to second leftmost branch of third level var ps121 = new ConcreteProcedureStep(p12); var ps122 = new ConcreteProcedureStep(p12); // is not related to ps121 ps12.LinkTo(ps121); // link adjacent levels ps11.AddRelatedStep(ps12); // relate steps of p1 ps1.LinkTo(ps11); // link adjacent levels var ps2 = new ConcreteProcedureStep(pRoot); var p2 = new Procedure(); // associative Procedure to right branch of second level var ps21 = new ConcreteProcedureStep(p2); var p21 = new Procedure(); // associative Procedure to second rightmost branch of third level var ps211 = new ConcreteProcedureStep(p21); var ps212 = new ConcreteProcedureStep(p21); // is not related to ps211 ps21.LinkTo(ps211); // link adjacent levels var ps22 = new ConcreteProcedureStep(p2); var p22 = new Procedure(); // associative Procedure to rightmost branch of third level var ps221 = new ConcreteProcedureStep(p22); var ps222 = new ConcreteProcedureStep(p22); // is not related to ps221 ps22.LinkTo(ps221); // link adjacent levels ps21.AddRelatedStep(ps22); // relate steps of p2 ps2.LinkTo(ps21); // link adjacent levels Assert.AreEqual(10, pRoot.GetWorkflowHistory().Count); // Assert all items in "tree" are present in Workflow history... except these ones: Assert.IsFalse(pRoot.GetWorkflowHistory().Contains(ps112)); Assert.IsFalse(pRoot.GetWorkflowHistory().Contains(ps122)); Assert.IsFalse(pRoot.GetWorkflowHistory().Contains(ps212)); Assert.IsFalse(pRoot.GetWorkflowHistory().Contains(ps222)); }
public void Test_GetWorkflowHistory_ThreeLevel() { var pRoot = new Procedure(); // associative Procedure to first level var ps1 = new ConcreteProcedureStep(pRoot); var p1 = new Procedure(); // associative Procedure to left branch of second level var ps11 = new ConcreteProcedureStep(p1); var p11 = new Procedure(); // associative Procedure to leftmost branch of third level var ps111 = new ConcreteProcedureStep(p11); var ps112 = new ConcreteProcedureStep(p11); ps111.AddRelatedStep(ps112); // relate steps of p11 ps11.LinkTo(ps111); // link adjacent levels var ps12 = new ConcreteProcedureStep(p1); var p12 = new Procedure(); // associative Procedure to second leftmost branch of third level var ps121 = new ConcreteProcedureStep(p12); var ps122 = new ConcreteProcedureStep(p12); ps121.AddRelatedStep(ps122); // relate steps of p12 ps12.LinkTo(ps121); // link adjacent levels ps11.AddRelatedStep(ps12); // relate steps of p1 ps1.LinkTo(ps11); // link adjacent levels var ps2 = new ConcreteProcedureStep(pRoot); var p2 = new Procedure(); // associative Procedure to right branch of second level var ps21 = new ConcreteProcedureStep(p2); var p21 = new Procedure(); // associative Procedure to second rightmost branch of third level var ps211 = new ConcreteProcedureStep(p21); var ps212 = new ConcreteProcedureStep(p21); ps211.AddRelatedStep(ps212); // relate steps of p21 ps21.LinkTo(ps211); // link adjacent levels var ps22 = new ConcreteProcedureStep(p2); var p22 = new Procedure(); // associative Procedure to rightmost branch of third level var ps221 = new ConcreteProcedureStep(p22); var ps222 = new ConcreteProcedureStep(p22); ps221.AddRelatedStep(ps222); // relate steps of p22 ps22.LinkTo(ps221); // link adjacent levels ps21.AddRelatedStep(ps22); // relate steps of p2 ps2.LinkTo(ps21); // link adjacent levels Assert.AreEqual(14, pRoot.GetWorkflowHistory().Count); // Assert all items in "tree" are present in Workflow history }