public void GetActivityTest() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true, Pending = true }; var activityB = new Activity("B", "somename2") { Included = true }; var activityC = new Activity("C", "somename3") { Included = false }; dcrGraph.AddActivities(activityA, activityB, activityC); var retrievedActivity = dcrGraph.GetActivity(activityB.Id); Assert.AreSame(activityB, retrievedActivity); }
public void ParseMortgageApplication2() { var graph = new DcrGraph(); graph.AddActivities(new Activity("Collect Documents", "Collect Documents") { Included = true, Roles = "Caseworker" }); graph.AddIncludeExclude(false, "Collect Documents", "Collect Documents"); graph.AddActivities(new Activity("Irregular neighbourhood", "Irregular neighbourhood") { Included = true, Roles = "it" }); graph.AddIncludeExclude(false, "Irregular neighbourhood", "Irregular neighbourhood"); graph.AddActivities(new Activity("Make appraisal appointment", "Make appraisal appointment") { Included = true, Roles = "Mobile consultant" }); graph.AddIncludeExclude(false, "Make appraisal appointment", "Make appraisal appointment"); graph.AddActivities(new Activity("Appraisal audit", "Appraisal audit") { Included = true, Roles = "Auditor" }); graph.AddIncludeExclude(false, "Appraisal audit", "Appraisal audit"); graph.AddActivities(new Activity("On-site appraisal", "On-site appraisal") { Included = true, Roles = "Mobile consulant" }); graph.AddIncludeExclude(false, "On-site appraisal", "On-site appraisal"); graph.AddActivities(new Activity("Submit budget", "Submit budget") { Included = true, Roles = "Customer" }); graph.AddIncludeExclude(false, "Submit budget", "Submit budget"); graph.AddActivities(new Activity("Budget screening approve", "Budget screening approve") { Included = true, Pending = true, Roles = "Intern" }); graph.AddIncludeExclude(false, "Budget screening approve", "Budget screening approve"); graph.AddActivities(new Activity("Statistical appraisal", "Statistical appraisal") { Included = true, Roles = "Caseworker" }); graph.AddIncludeExclude(false, "Statistical appraisal", "Statistical appraisal"); graph.AddActivities(new Activity("Assess loan application", "Assess loan application") { Included = true, Pending = true, Roles = "Caseworker" }); graph.AddIncludeExclude(false, "Assess loan application", "Assess loan application"); graph.AddCondition("Collect Documents", "Irregular neighbourhood"); graph.AddCondition("Collect Documents", "Make appraisal appointment"); graph.AddCondition("Collect Documents", "On-site appraisal"); graph.AddCondition("Collect Documents", "Statistical appraisal"); graph.AddIncludeExclude(false, "Statistical appraisal", "Irregular neighbourhood"); graph.AddIncludeExclude(false, "Statistical appraisal", "Make appraisal appointment"); graph.AddIncludeExclude(false, "Statistical appraisal", "On-site appraisal"); graph.AddIncludeExclude(false, "Irregular neighbourhood","Statistical appraisal"); graph.AddIncludeExclude(false, "Make appraisal appointment","Statistical appraisal" ); graph.AddIncludeExclude(false, "On-site appraisal","Statistical appraisal"); graph.AddCondition("Irregular neighbourhood", "Make appraisal appointment"); graph.AddCondition("Make appraisal appointment", "On-site appraisal"); graph.AddCondition("On-site appraisal", "Submit budget"); graph.AddCondition("Submit budget", "Budget screening approve"); graph.AddCondition("Budget screening approve", "Assess loan application"); graph.AddCondition("Assess loan application","Appraisal audit"); graph.AddCondition("Statistical appraisal", "Submit budget"); var nested = new HashSet<Activity>(); nested.Add(graph.GetActivity("Irregular neighbourhood")); nested.Add(graph.GetActivity("Make appraisal appointment")); nested.Add(graph.GetActivity("On-site appraisal")); graph.MakeNestedGraph(nested); //LogGenerator9001 logGenerator9001 = new LogGenerator9001(20, graph); //Log log = new Log(); //foreach (var trace in logGenerator9001.GenerateLog(500)) //{ // log.AddTrace(trace); //} using (StreamWriter sw = new StreamWriter("C:/Downloads/mortgageStrict.xml")) { sw.WriteLine(graph.ExportToXml()); } }
public void GetNestedActivityTest() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true }; var activityB = new Activity("B", "somename2") { Included = true }; var activityC = new Activity("C", "somename3") { Included = true }; var activityD = new Activity("D", "somename4") { Included = false }; var activityE = new Activity("E", "somename5") { Included = true }; var activityF = new Activity("F", "somename6") { Included = true }; dcrGraph.AddActivities(activityA, activityB, activityC, activityD, activityE, activityF); dcrGraph.AddIncludeExclude(true, activityC.Id, activityD.Id); dcrGraph.AddCondition(activityE.Id, activityF.Id); //outgoing relation //ingoing relations dcrGraph.AddCondition(activityA.Id, activityC.Id); dcrGraph.AddCondition(activityA.Id, activityD.Id); dcrGraph.AddCondition(activityA.Id, activityE.Id); dcrGraph.MakeNestedGraph(new HashSet<Activity>() { activityC, activityD, activityE }); var retrievedActivity = dcrGraph.GetActivity(activityC.Id); Assert.AreEqual(activityC.ToString(), retrievedActivity.ToString()); }