public void ConditionNegativeTest() { var a = new Activity("A", "nameA"); var b = new Activity("B", "nameB"); var exhaust = new ContradictionApproach(new HashSet<Activity>() { a, b }); exhaust.AddEvent("B", "1000"); exhaust.Stop(); HashSet<Activity> con; exhaust.Graph.Conditions.TryGetValue(a, out con); Assert.IsFalse(con.Contains(b)); }
public void ExhaustiveTest() { var traceId = 1000; var activities = new HashSet<Activity>(); for (char ch = 'A'; ch <= 'G'; ch++) { activities.Add(new Activity("" + ch, "somename " + ch)); } var inputLog = new Log(); var currentTrace = new LogTrace() {Id = traceId++.ToString()}; inputLog.Traces.Add(currentTrace); var exAl = new ContradictionApproach(activities); int id = 0; while (true) { var input = Console.ReadLine(); switch (input) { case "STOP": exAl.Stop(); currentTrace = currentTrace.Copy(); currentTrace = new LogTrace() { Id = traceId++.ToString() }; inputLog.Traces.Add(currentTrace); break; case "AUTOLOG": Console.WriteLine("Please input a termination index between 0 - 100 : \n"); var logGen = new LogGenerator9001(Convert.ToInt32(Console.ReadLine()), exAl.Graph); Console.WriteLine("Please input number of desired traces to generate : \n"); List<LogTrace> log = logGen.GenerateLog(Convert.ToInt32(Console.ReadLine())); foreach (var trace in log) { Console.WriteLine(trace); } break; case "REDUNDANCY": exAl.Graph = new RedundancyRemover().RemoveRedundancy(exAl.Graph); break; case "POST": exAl.Graph = ContradictionApproach.PostProcessing(exAl.Graph); break; case "NESTED": exAl.Graph = ContradictionApproach.CreateNests(exAl.Graph); break; case "CHANGE TRACE": inputLog.Traces.Add(currentTrace); var newId = Console.ReadLine(); currentTrace = inputLog.Traces.Find(x => x.Id == newId) ?? new LogTrace() { Id = newId}; break; default: if (exAl.Graph.GetActivities().Any(a => a.Id == input)) { exAl.AddEvent(input, currentTrace.Id); currentTrace.Add(new LogEvent(input, "somename" + input) {EventId = "" + id++}); } break; } Console.WriteLine("Current trace id: " + currentTrace.Id); Console.WriteLine(exAl.Graph); //the quality probably suffers because the traces contains unfinished traces. Console.WriteLine(QualityDimensionRetriever.Retrieve(exAl.Graph, inputLog)); } }