Exemplo n.º 1
0
        public void CaseListContructorTest1()
        {
            List<Event> eventList = new List<Event> {new Event("A"), new Event("B"), new Event("C"), new Event("D")};

            //create Case
            Case ca = new Case {EventList = eventList};

            foreach (Event e in ca.EventList)
            {
                if (e.Name.Equals("A"))
                {

                }
                else if (e.Name.Equals("B"))
                {

                }
                else if (e.Name.Equals("C"))
                {

                }
                else if (e.Name.Equals("D"))
                {

                }
                else
                {
                    Assert.Fail("Event not in case");
                }
            }
        }
        private EventLog createEventLogFrom(string sourceFile)
        {
            //The Method should return a list with EventLogs!

            EventLog eventLog = new EventLog(Path.GetFileName(sourceFile));
            Case caseFound = new Case();
            Event eventFound = new Event();

            String theActualElement = "";

            XmlTextReader reader = new XmlTextReader(sourceFile);
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element: // The node is an element.
                        theActualElement = reader.Name.ToLower();

                        if (reader.Name.ToLower().Equals("processinstance"))
                        {
                            //A new Case starts
                            caseFound = new Case(reader.GetAttribute("id"));
                        }
                        else if (reader.Name.ToLower().Equals("audittrailentry"))
                        {
                            //A new transition starts
                            eventFound = new Event();
                        }

                        break;
                    case XmlNodeType.Text: //Display the text in each element.
                        if (theActualElement.Equals("workflowmodelelement"))
                        {
                            eventFound.Name = reader.Value;
                        }
                        else if (theActualElement.Equals("timestamp"))
                        {
                            eventFound.Information.Add("TIMESTAMP", reader.Value);
                        }
                        break;
                    case XmlNodeType.EndElement: //Display the end of the element.
                        if (reader.Name.ToLower().Equals("processinstance"))
                        {
                            //The case ends in the mxml file and the case must put to the eventlog
                            eventLog.Cases.Add(caseFound);
                        }
                        else if (reader.Name.ToLower().Equals("audittrailentry"))
                        {
                            //The transition ends here
                            caseFound.EventList.Add(eventFound);
                        }

                        break;
                }
            }

            return eventLog;
        }
        public void GetTransitionsNotFoundAsDictionaryTest()
        {
            var case1 = new Case("case1") { EventList = new List<Event> { new Event("A"), new Event("B") } };
            var case2 = new Case("case2") { EventList = new List<Event> { new Event("C"), new Event("D") } };
            var result = new TokenReplayResult
            {
                FailedCasesTransitionNotFound = new List<Case> { case1, case1, case2 },
            };

            var dict = (Dictionary<string, int>)result.GetTransitionsNotFoundAsDictionary();
            Assert.AreEqual(2, dict["A, B"]);
            Assert.AreEqual(1, dict["C, D"]);
        }
Exemplo n.º 4
0
        public void CaseAddEventTest1()
        {
            List<Event> eventList = new List<Event> {new Event("A")};

            //create Case and add event a
            Case ca = new Case("CaseName", eventList);

            //add event b
            ca.CreateEvent("B");

            //add event c
            ca.EventList.Add(new Event("C"));

            //add event d
            Event eventD = new Event {Name = "D"};
            ca.EventList.Add(eventD);

            foreach (Event e in ca.EventList)
            {
                if (e.Name.Equals("A"))
                {

                }
                else if (e.Name.Equals("B"))
                {

                }
                else if (e.Name.Equals("C"))
                {

                }
                else if (e.Name.Equals("D"))
                {

                }
                else
                {
                    Assert.Fail("Event not in case");
                }
            }
        }
        /// <summary>
        /// This method creates an complex event log from the Process Mining book 
        /// of van der Aalst site 195 Table 7.1.
        /// </summary>
        /// <autor>Markus Holznagel</autor>
        public static EventLog ComplexEventLogVanDerAalst()
        {
            //create Case1
            Case ca1 = new Case();
            ca1.CreateEvent("A");
            ca1.CreateEvent("C");
            ca1.CreateEvent("D");
            ca1.CreateEvent("E");
            ca1.CreateEvent("H");

            //create Case2
            Case ca2 = new Case();
            ca2.CreateEvent("A");
            ca2.CreateEvent("B");
            ca2.CreateEvent("D");
            ca2.CreateEvent("E");
            ca2.CreateEvent("G");

            //create Case3
            Case ca3 = new Case();
            ca3.CreateEvent("A");
            ca3.CreateEvent("D");
            ca3.CreateEvent("C");
            ca3.CreateEvent("E");
            ca3.CreateEvent("H");

            //create Case4
            Case ca4 = new Case();
            ca4.CreateEvent("A");
            ca4.CreateEvent("B");
            ca4.CreateEvent("D");
            ca4.CreateEvent("E");
            ca4.CreateEvent("H");

            //create Case5
            Case ca5 = new Case();
            ca5.CreateEvent("A");
            ca5.CreateEvent("C");
            ca5.CreateEvent("D");
            ca5.CreateEvent("E");
            ca5.CreateEvent("G");

            //create Case6
            Case ca6 = new Case();
            ca6.CreateEvent("A");
            ca6.CreateEvent("D");
            ca6.CreateEvent("C");
            ca6.CreateEvent("E");
            ca6.CreateEvent("G");

            //create Case7
            Case ca7 = new Case();
            ca7.CreateEvent("A");
            ca7.CreateEvent("D");
            ca7.CreateEvent("B");
            ca7.CreateEvent("E");
            ca7.CreateEvent("H");

            //create Case8
            Case ca8 = new Case();
            ca8.CreateEvent("A");
            ca8.CreateEvent("C");
            ca8.CreateEvent("D");
            ca8.CreateEvent("E");
            ca8.CreateEvent("F");
            ca8.CreateEvent("D");
            ca8.CreateEvent("B");
            ca8.CreateEvent("E");
            ca8.CreateEvent("H");

            //create Case9
            Case ca9 = new Case();
            ca9.CreateEvent("A");
            ca9.CreateEvent("D");
            ca9.CreateEvent("B");
            ca9.CreateEvent("E");
            ca9.CreateEvent("G");

            //create Case10
            Case ca10 = new Case();
            ca10.CreateEvent("A");
            ca10.CreateEvent("C");
            ca10.CreateEvent("D");
            ca10.CreateEvent("E");
            ca10.CreateEvent("F");
            ca10.CreateEvent("B");
            ca10.CreateEvent("D");
            ca10.CreateEvent("E");
            ca10.CreateEvent("H");

            //create Case11
            Case ca11 = new Case();
            ca11.CreateEvent("A");
            ca11.CreateEvent("C");
            ca11.CreateEvent("D");
            ca11.CreateEvent("E");
            ca11.CreateEvent("F");
            ca11.CreateEvent("B");
            ca11.CreateEvent("D");
            ca11.CreateEvent("E");
            ca11.CreateEvent("G");

            //create Case12
            Case ca12 = new Case();
            ca12.CreateEvent("A");
            ca12.CreateEvent("C");
            ca12.CreateEvent("D");
            ca12.CreateEvent("E");
            ca12.CreateEvent("F");
            ca12.CreateEvent("D");
            ca12.CreateEvent("B");
            ca12.CreateEvent("E");
            ca12.CreateEvent("G");

            //create Case13
            Case ca13 = new Case();
            ca13.CreateEvent("A");
            ca13.CreateEvent("D");
            ca13.CreateEvent("C");
            ca13.CreateEvent("E");
            ca13.CreateEvent("F");
            ca13.CreateEvent("C");
            ca13.CreateEvent("D");
            ca13.CreateEvent("E");
            ca13.CreateEvent("H");

            //create Case14
            Case ca14 = new Case();
            ca14.CreateEvent("A");
            ca14.CreateEvent("D");
            ca14.CreateEvent("C");
            ca14.CreateEvent("E");
            ca14.CreateEvent("F");
            ca14.CreateEvent("D");
            ca14.CreateEvent("B");
            ca14.CreateEvent("E");
            ca14.CreateEvent("H");

            //create Case15
            Case ca15 = new Case();
            ca15.CreateEvent("A");
            ca15.CreateEvent("D");
            ca15.CreateEvent("C");
            ca15.CreateEvent("E");
            ca15.CreateEvent("F");
            ca15.CreateEvent("B");
            ca15.CreateEvent("D");
            ca15.CreateEvent("E");
            ca15.CreateEvent("G");

            //create Case16
            Case ca16 = new Case();
            ca16.CreateEvent("A");
            ca16.CreateEvent("C");
            ca16.CreateEvent("D");
            ca16.CreateEvent("E");
            ca16.CreateEvent("F");
            ca16.CreateEvent("B");
            ca16.CreateEvent("D");
            ca16.CreateEvent("E");
            ca16.CreateEvent("F");
            ca16.CreateEvent("D");
            ca16.CreateEvent("B");
            ca16.CreateEvent("E");
            ca16.CreateEvent("G");

            //create Case17
            Case ca17 = new Case();
            ca17.CreateEvent("A");
            ca17.CreateEvent("D");
            ca17.CreateEvent("C");
            ca17.CreateEvent("E");
            ca17.CreateEvent("F");
            ca17.CreateEvent("D");
            ca17.CreateEvent("B");
            ca17.CreateEvent("E");
            ca17.CreateEvent("G");

            //create Case18
            Case ca18 = new Case();
            ca18.CreateEvent("A");
            ca18.CreateEvent("D");
            ca18.CreateEvent("C");
            ca18.CreateEvent("E");
            ca18.CreateEvent("F");
            ca18.CreateEvent("B");
            ca18.CreateEvent("D");
            ca18.CreateEvent("E");
            ca18.CreateEvent("F");
            ca18.CreateEvent("B");
            ca18.CreateEvent("D");
            ca18.CreateEvent("E");
            ca18.CreateEvent("G");

            //create Case19
            Case ca19 = new Case();
            ca19.CreateEvent("A");
            ca19.CreateEvent("D");
            ca19.CreateEvent("C");
            ca19.CreateEvent("E");
            ca19.CreateEvent("F");
            ca19.CreateEvent("D");
            ca19.CreateEvent("B");
            ca19.CreateEvent("E");
            ca19.CreateEvent("F");
            ca19.CreateEvent("B");
            ca19.CreateEvent("D");
            ca19.CreateEvent("E");
            ca19.CreateEvent("H");

            //create Case20
            Case ca20 = new Case();
            ca20.CreateEvent("A");
            ca20.CreateEvent("D");
            ca20.CreateEvent("B");
            ca20.CreateEvent("E");
            ca20.CreateEvent("F");
            ca20.CreateEvent("B");
            ca20.CreateEvent("D");
            ca20.CreateEvent("E");
            ca20.CreateEvent("F");
            ca20.CreateEvent("D");
            ca20.CreateEvent("B");
            ca20.CreateEvent("E");
            ca20.CreateEvent("G");

            //create Case21
            Case ca21 = new Case();
            ca21.CreateEvent("A");
            ca21.CreateEvent("D");
            ca21.CreateEvent("C");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("D");
            ca21.CreateEvent("B");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("C");
            ca21.CreateEvent("D");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("D");
            ca21.CreateEvent("B");
            ca21.CreateEvent("E");
            ca21.CreateEvent("G");

            //create Event Log
            EventLog eventLog = new EventLog();
            eventLog.Cases.Add(ca1);
            eventLog.Cases.Add(ca2);
            eventLog.Cases.Add(ca3);
            eventLog.Cases.Add(ca4);
            eventLog.Cases.Add(ca5);
            eventLog.Cases.Add(ca6);
            eventLog.Cases.Add(ca7);
            eventLog.Cases.Add(ca8);
            eventLog.Cases.Add(ca9);
            eventLog.Cases.Add(ca10);
            eventLog.Cases.Add(ca11);
            eventLog.Cases.Add(ca12);
            eventLog.Cases.Add(ca13);
            eventLog.Cases.Add(ca14);
            eventLog.Cases.Add(ca15);
            eventLog.Cases.Add(ca16);
            eventLog.Cases.Add(ca17);
            eventLog.Cases.Add(ca18);
            eventLog.Cases.Add(ca19);
            eventLog.Cases.Add(ca20);
            eventLog.Cases.Add(ca21);

            return eventLog;
        }
        public void FootprintMergeHeaderNameTest1()
        {
            //create Case1
            Case ca = new Case();
            ca.CreateEvent("A");
            ca.CreateEvent("B");
            ca.CreateEvent("C");
            ca.CreateEvent("D");

            //create Case2
            Case ca2 = new Case();
            ca2.CreateEvent("AA");
            ca2.CreateEvent("CC");
            ca2.CreateEvent("BB");
            ca2.CreateEvent("DD");

            //create Case3
            Case ca3 = new Case();
            ca2.CreateEvent("A");
            ca2.CreateEvent("CC");
            ca2.CreateEvent("B");
            ca2.CreateEvent("ZZZ");

            //create Footprint list
            List<ComparingFootprint> footprintList = new List<ComparingFootprint>();

            ComparingFootprint foot1 = ComparingFootprintAlgorithm.CreateFootprint(ca);
            footprintList.Add(foot1);

            ComparingFootprint foot2 = ComparingFootprintAlgorithm.CreateFootprint(ca2);
            footprintList.Add(foot2);

            ComparingFootprint foot3 = ComparingFootprintAlgorithm.CreateFootprint(ca3);
            footprintList.Add(foot3);

            ComparingFootprint footResult = ComparingFootprintAlgorithm.MergeFootprints(footprintList);

            List<String> headerNames = footResult.HeaderWithEventNames;

            int i = 0;
            foreach (String hName in headerNames)
            {
                if (hName.Equals("A"))
                {
                    i++;
                }
                else if (hName.Equals("B"))
                {
                    i++;
                }
                else if (hName.Equals("C"))
                {
                    i++;
                }
                else if (hName.Equals("D"))
                {
                    i++;
                }
                else if (hName.Equals("AA"))
                {
                    i++;
                }
                else if (hName.Equals("BB"))
                {
                    i++;
                }
                else if (hName.Equals("CC"))
                {
                    i++;
                }
                else if (hName.Equals("DD"))
                {
                    i++;
                }
                else if (hName.Equals("ZZZ"))
                {
                    i++;
                }
                else
                {
                    Assert.Fail();
                }
            }

            if (i != 9 || 9 != headerNames.Count || i != headerNames.Count)
            {
                Assert.Fail();
            }
        }
        public void CreateFootprintFromEventLogTest1()
        {
            //create Case1
            Case ca = new Case();
            ca.CreateEvent("A");
            ca.CreateEvent("B");
            ca.CreateEvent("C");
            ca.CreateEvent("D");

            //create Case2
            Case ca2 = new Case();
            ca2.CreateEvent("AA");
            ca2.CreateEvent("CC");
            ca2.CreateEvent("BB");
            ca2.CreateEvent("DD");

            //create Case3
            Case ca3 = new Case();
            ca2.CreateEvent("A");
            ca2.CreateEvent("CC");
            ca2.CreateEvent("B");
            ca2.CreateEvent("ZZZ");

            EventLog eventLog = new EventLog();
            eventLog.Cases.Add(ca);
            eventLog.Cases.Add(ca2);
            eventLog.Cases.Add(ca3);

            ComparingFootprint footResult = ComparingFootprintAlgorithm.CreateFootprint(eventLog);

            List<String> headerNames = footResult.HeaderWithEventNames;

            int i = 0;
            foreach (String hName in headerNames)
            {
                if (hName.Equals("A"))
                {
                    i++;
                }
                else if (hName.Equals("B"))
                {
                    i++;
                }
                else if (hName.Equals("C"))
                {
                    i++;
                }
                else if (hName.Equals("D"))
                {
                    i++;
                }
                else if (hName.Equals("AA"))
                {
                    i++;
                }
                else if (hName.Equals("BB"))
                {
                    i++;
                }
                else if (hName.Equals("CC"))
                {
                    i++;
                }
                else if (hName.Equals("DD"))
                {
                    i++;
                }
                else if (hName.Equals("ZZZ"))
                {
                    i++;
                }
                else
                {
                    Assert.Fail();
                }
            }

            if (i != 9 || 9 != headerNames.Count || i != headerNames.Count)
            {
                Assert.Fail();
            }
        }
        public void EventLogAddAndGetCaseTest3()
        {
            EventLog el = new EventLog(name: "EventLogName");

            //create Case1
            Case ca = new Case("Case1");
            ca.CreateEvent("A");
            ca.CreateEvent("B");
            ca.CreateEvent("C");
            ca.CreateEvent("D");

            //create Case2
            Case ca2 = new Case("Case2");
            ca2.CreateEvent("AA");
            ca2.CreateEvent("CC");
            ca2.CreateEvent("BB");
            ca2.CreateEvent("DD");

            Case ca3 = new Case("Case3");
            ca3.CreateEvent("AAA");
            ca3.CreateEvent("CCC");
            ca3.CreateEvent("BBB");
            ca3.CreateEvent("DDD");

            el.Cases.Add(ca);
            el.Cases.Add(ca2);
            el.Cases.Add(ca3);

            Case caseGet2 = el.GetCaseByName("Case2");
            int countEvents = 0;
            foreach (Event e in caseGet2.EventList)
            {
                if (e.Name.Equals("AA")
                    || e.Name.Equals("BB")
                    || e.Name.Equals("CC")
                    || e.Name.Equals("DD"))
                {
                    countEvents++;
                }
                else
                {
                    Assert.Fail("Event not in cases and not in eventlog");
                }
            }

            if (countEvents != 4) Assert.Fail("not the right number of cases in the event log countEvents:" + countEvents);

            //
            // Overwrite test:
            //
            Case caNew3 = new Case("Case3");
            caNew3.CreateEvent("NewAAA");
            caNew3.CreateEvent("NewCCC");
            caNew3.CreateEvent("NewBBB");
            caNew3.CreateEvent("NewDDD");

            el.Cases.Add(caNew3);

            Case caseGet3 = el.GetCaseByName("Case3");

            countEvents = 0;
            foreach (Event e in caseGet3.EventList)
            {
                Debug.WriteLine("e.Name:" + e.Name);

                if (e.Name.Equals("AAA")
                    || e.Name.Equals("CCC")
                    || e.Name.Equals("BBB")
                    || e.Name.Equals("DDD"))
                {
                    countEvents++;
                }
                else if (e.Name.Equals("NewAAA")
                    || e.Name.Equals("NewCCC")
                    || e.Name.Equals("NewBBB")
                    || e.Name.Equals("NewDDD"))
                {
                    Assert.Fail("Overwrite test failed");
                }
            }

            if (countEvents != 4) Assert.Fail("not the right number of cases in the event log (countEvents:" + countEvents + ")");
        }
        /// <summary>
        /// Create a footprint from one case
        /// </summary>
        /// <param name="c">A case</param>
        /// <param name="cases">A list of cases</param>
        /// <autor>Andrej Albrecht</autor>
        public static ComparingFootprint CreateFootprint(Case c, List<Case> cases = null)
        {
            ComparingFootprint footprint = new ComparingFootprint();

            foreach (Event Event in c.EventList)
                footprint.AddEventHeader(Event.Name);

            int numberOfEventsInCase = c.EventList.Count;
            CellType[,] resultMatrix = new CellType[numberOfEventsInCase, numberOfEventsInCase];

            for (int row = 0; row < footprint.HeaderWithEventNames.Count; row++)
            {
                for (int column = 0; column < footprint.HeaderWithEventNames.Count; column++)
                {
                    //first of all, reset the cellstate to nothing:
                    resultMatrix[row, column] = CellType.Nothing;

                    //Go through all events of the case
                    for (int eventIndex = 0; eventIndex < c.EventList.Count - 1; eventIndex++)
                    {
                        String leftEventName = c.EventList.ElementAt(eventIndex).Name;
                        String rightEventName = c.EventList.ElementAt(eventIndex + 1).Name;

                        if (footprint.HeaderWithEventNames[row].Equals(leftEventName) && footprint.HeaderWithEventNames[column].Equals(rightEventName) &&
                            leftEventName.Equals(rightEventName))
                        {
                            resultMatrix[row, column] = CellType.Loop;
                            resultMatrix[row, column] = CellType.Loop;
                        }

                        else if (footprint.HeaderWithEventNames[row].Equals(leftEventName) && footprint.HeaderWithEventNames[column].Equals(rightEventName))
                        {
                            if (resultMatrix[row, column].Equals(CellType.Left))
                                resultMatrix[row, column] = CellType.Parallel;

                            else if (resultMatrix[row, column].Equals(CellType.Nothing))
                            {
                                resultMatrix[row, column] = CellType.Right;

                                if (row != column)
                                {
                                    resultMatrix[column, row] = CellType.Left;
                                    //ResultMatrix[Row, Column] = CellType.Left;
                                }

                            }
                        }

                        else if (footprint.HeaderWithEventNames[row].Equals(rightEventName) && footprint.HeaderWithEventNames[column].Equals(leftEventName))
                        {
                            if (resultMatrix[row, column].Equals(CellType.Right))
                                resultMatrix[row, column] = CellType.Parallel;

                            else if (resultMatrix[row, column].Equals(CellType.Nothing)){
                                resultMatrix[row, column] = CellType.Left;
                            }
                            else if (resultMatrix[row, column].Equals(CellType.Parallel))
                                resultMatrix[row, column] = CellType.Parallel;
                        }

                    }
                }
            }

            footprint.ResultMatrix = resultMatrix;

            return footprint;
        }
        /// <summary>
        /// This method creates an event log with three cases.
        /// </summary>
        /// <autor>Markus Holznagel</autor>
        public static EventLog ThreeCaseEventLog()
        {
            // Create Case 1
            Case ca1 = new Case();
            ca1.CreateEvent("A");
            ca1.CreateEvent("B");
            ca1.CreateEvent("D");
            ca1.CreateEvent("E");

            // Create Case 2
            Case ca2 = new Case();
            ca2.CreateEvent("A");
            ca2.CreateEvent("D");
            ca2.CreateEvent("B");
            ca2.CreateEvent("E");

            // Create Case 3
            Case ca3 = new Case();
            ca3.CreateEvent("A");
            ca3.CreateEvent("C");
            ca3.CreateEvent("E");

            //Create Event Log
            EventLog eventLog = new EventLog();
            eventLog.Cases.Add(ca1);
            eventLog.Cases.Add(ca2);
            eventLog.Cases.Add(ca3);

            return eventLog;
        }
        /// <summary>
        /// This method creates an event log with one case.
        /// </summary>
        /// <autor>Andrej Albrecht, Markus Holznagel</autor>
        public static EventLog OneCaseEventLogSwitchTheMiddle()
        {
            //Create case
            Case ca = new Case();
            ca.CreateEvent("A");
            ca.CreateEvent("C");
            ca.CreateEvent("B");
            ca.CreateEvent("D");

            //Create event log
            EventLog eventLog = new EventLog();

            return eventLog;
        }
Exemplo n.º 12
0
 public void IndexesOfPairTest()
 {
     Case ca = new Case();
     Event ev1 = new Event { Name = "first" };
     Event ev2 = new Event { Name = "second" };
     ca.EventList.Add(ev1);
     ca.EventList.Add(ev2);
     List<int> list = ca.IndexesOfPair(ev1, ev2);
     Assert.IsTrue(list.Count==1);
 }
Exemplo n.º 13
0
 public void EventFollowsEventCountTest()
 {
     Case ca = new Case();
     Event ev1 = new Event {Name = "first"};
     Event ev2 = new Event {Name = "second"};
     ca.EventList.Add(ev1);
     ca.EventList.Add(ev2);
     Assert.IsTrue(ca.EventFollowsEventCount(ev1, ev2)==1,"Count: " + ca.EventFollowsEventCount(ev1,ev2));
 }
Exemplo n.º 14
0
 public void CreateEventTest()
 {
     Case ca = new Case();
     ca.CreateEvent("TestEvent");
     Assert.IsTrue(ca.EventList.Where(ev => ev.Name == "TestEvent").Select(ev => ev.Name).Count()==1);
 }
Exemplo n.º 15
0
        public void CaseTest1()
        {
            //create Case
            Case ca = new Case();
            ca.CreateEvent("A");
            ca.CreateEvent("B");
            ca.CreateEvent("C");
            ca.CreateEvent("D");

            foreach(Event e in ca.EventList)
            {
                if (e.Name.Equals("A"))
                {

                }
                else if (e.Name.Equals("B"))
                {

                }
                else if (e.Name.Equals("C"))
                {

                }
                else if (e.Name.Equals("D"))
                {

                }
                else
                {
                    Assert.Fail("Event not in case");
                }
            }

            ca.EventList.Remove(new Event("C"));

            foreach (Event e in ca.EventList)
            {
                if (e.Name.Equals("C"))
                {
                    Assert.Fail("removed event is in case");
                }

                if (e.Name.Equals("A"))
                {

                }
                else if (e.Name.Equals("B"))
                {

                }
                else if (e.Name.Equals("D"))
                {

                }
                else
                {
                    Assert.Fail("Event not in case");
                }
            }
        }
        /// <summary>
        /// This method creates an event log for recursive parallelisms.
        /// </summary>
        /// <autor>Markus Holznagel</autor>
        public static EventLog EventLogForRecursiveParallelisms()
        {
            // Create Case 1
            Case ca1 = new Case();
            ca1.CreateEvent("A");
            ca1.CreateEvent("B");
            ca1.CreateEvent("C");
            ca1.CreateEvent("D");
            ca1.CreateEvent("F");
            ca1.CreateEvent("H");
            ca1.CreateEvent("J");
            ca1.CreateEvent("L");
            ca1.CreateEvent("M");
            ca1.CreateEvent("N");

            // Create Case 2
            Case ca2 = new Case();
            ca2.CreateEvent("A");
            ca2.CreateEvent("B");
            ca2.CreateEvent("C");
            ca2.CreateEvent("D");
            ca2.CreateEvent("F");
            ca2.CreateEvent("H");
            ca2.CreateEvent("K");
            ca2.CreateEvent("L");
            ca2.CreateEvent("M");
            ca2.CreateEvent("N");

            // Create Case 3
            Case ca3 = new Case();
            ca3.CreateEvent("A");
            ca3.CreateEvent("B");
            ca3.CreateEvent("C");
            ca3.CreateEvent("D");
            ca3.CreateEvent("F");
            ca3.CreateEvent("I");
            ca3.CreateEvent("J");
            ca3.CreateEvent("L");
            ca3.CreateEvent("M");
            ca3.CreateEvent("N");

            // Create Case 4
            Case ca4 = new Case();
            ca4.CreateEvent("A");
            ca4.CreateEvent("B");
            ca4.CreateEvent("C");
            ca4.CreateEvent("D");
            ca4.CreateEvent("F");
            ca4.CreateEvent("I");
            ca4.CreateEvent("K");
            ca4.CreateEvent("L");
            ca4.CreateEvent("M");
            ca4.CreateEvent("N");

            // Create Case 5
            Case ca5 = new Case();
            ca5.CreateEvent("A");
            ca5.CreateEvent("B");
            ca5.CreateEvent("C");
            ca5.CreateEvent("D");
            ca5.CreateEvent("G");
            ca5.CreateEvent("H");
            ca5.CreateEvent("J");
            ca5.CreateEvent("L");
            ca5.CreateEvent("M");
            ca5.CreateEvent("N");

            // Create Case 6
            Case ca6 = new Case();
            ca6.CreateEvent("A");
            ca6.CreateEvent("B");
            ca6.CreateEvent("C");
            ca6.CreateEvent("D");
            ca6.CreateEvent("G");
            ca6.CreateEvent("H");
            ca6.CreateEvent("K");
            ca6.CreateEvent("L");
            ca6.CreateEvent("M");
            ca6.CreateEvent("N");

            // Create Case 7
            Case ca7 = new Case();
            ca7.CreateEvent("A");
            ca7.CreateEvent("B");
            ca7.CreateEvent("C");
            ca7.CreateEvent("D");
            ca7.CreateEvent("G");
            ca7.CreateEvent("I");
            ca7.CreateEvent("J");
            ca7.CreateEvent("L");
            ca7.CreateEvent("M");
            ca7.CreateEvent("N");

            // Create Case 8
            Case ca8 = new Case();
            ca8.CreateEvent("A");
            ca8.CreateEvent("B");
            ca8.CreateEvent("C");
            ca8.CreateEvent("D");
            ca8.CreateEvent("G");
            ca8.CreateEvent("I");
            ca8.CreateEvent("K");
            ca8.CreateEvent("L");
            ca8.CreateEvent("M");
            ca8.CreateEvent("N");

            // Create Case 9
            Case ca9 = new Case();
            ca9.CreateEvent("A");
            ca9.CreateEvent("B");
            ca9.CreateEvent("C");
            ca9.CreateEvent("E");
            ca9.CreateEvent("F");
            ca9.CreateEvent("H");
            ca9.CreateEvent("J");
            ca9.CreateEvent("L");
            ca9.CreateEvent("M");
            ca9.CreateEvent("N");

            // Create Case 10
            Case ca10 = new Case();
            ca10.CreateEvent("A");
            ca10.CreateEvent("B");
            ca10.CreateEvent("C");
            ca10.CreateEvent("E");
            ca10.CreateEvent("F");
            ca10.CreateEvent("H");
            ca10.CreateEvent("K");
            ca10.CreateEvent("L");
            ca10.CreateEvent("M");
            ca10.CreateEvent("N");

            // Create Case 11
            Case ca11 = new Case();
            ca11.CreateEvent("A");
            ca11.CreateEvent("B");
            ca11.CreateEvent("C");
            ca11.CreateEvent("E");
            ca11.CreateEvent("F");
            ca11.CreateEvent("I");
            ca11.CreateEvent("J");
            ca11.CreateEvent("L");
            ca11.CreateEvent("M");
            ca11.CreateEvent("N");

            // Create Case 12
            Case ca12 = new Case();
            ca12.CreateEvent("A");
            ca12.CreateEvent("B");
            ca12.CreateEvent("C");
            ca12.CreateEvent("E");
            ca12.CreateEvent("F");
            ca12.CreateEvent("I");
            ca12.CreateEvent("K");
            ca12.CreateEvent("L");
            ca12.CreateEvent("M");
            ca12.CreateEvent("N");

            // Create Case 13
            Case ca13 = new Case();
            ca13.CreateEvent("A");
            ca13.CreateEvent("B");
            ca13.CreateEvent("C");
            ca13.CreateEvent("E");
            ca13.CreateEvent("G");
            ca13.CreateEvent("H");
            ca13.CreateEvent("J");
            ca13.CreateEvent("L");
            ca13.CreateEvent("M");
            ca13.CreateEvent("N");

            // Create Case 14
            Case ca14 = new Case();
            ca14.CreateEvent("A");
            ca14.CreateEvent("B");
            ca14.CreateEvent("C");
            ca14.CreateEvent("E");
            ca14.CreateEvent("G");
            ca14.CreateEvent("H");
            ca14.CreateEvent("K");
            ca14.CreateEvent("L");
            ca14.CreateEvent("M");
            ca14.CreateEvent("N");

            // Create Case 15
            Case ca15 = new Case();
            ca15.CreateEvent("A");
            ca15.CreateEvent("B");
            ca15.CreateEvent("C");
            ca15.CreateEvent("E");
            ca15.CreateEvent("G");
            ca15.CreateEvent("I");
            ca15.CreateEvent("J");
            ca15.CreateEvent("L");
            ca15.CreateEvent("M");
            ca15.CreateEvent("N");

            // Create Case 16
            Case ca16 = new Case();
            ca16.CreateEvent("A");
            ca16.CreateEvent("B");
            ca16.CreateEvent("C");
            ca16.CreateEvent("E");
            ca16.CreateEvent("G");
            ca16.CreateEvent("I");
            ca16.CreateEvent("K");
            ca16.CreateEvent("L");
            ca16.CreateEvent("M");
            ca16.CreateEvent("N");

            // Create event log
            EventLog eventLog = new EventLog();
            eventLog.Cases.Add(ca1);
            eventLog.Cases.Add(ca2);
            eventLog.Cases.Add(ca3);
            eventLog.Cases.Add(ca4);
            eventLog.Cases.Add(ca5);
            eventLog.Cases.Add(ca6);
            eventLog.Cases.Add(ca7);
            eventLog.Cases.Add(ca8);
            eventLog.Cases.Add(ca9);
            eventLog.Cases.Add(ca10);
            eventLog.Cases.Add(ca11);
            eventLog.Cases.Add(ca12);
            eventLog.Cases.Add(ca13);
            eventLog.Cases.Add(ca14);
            eventLog.Cases.Add(ca15);
            eventLog.Cases.Add(ca16);

            return eventLog;
        }
        /// <summary>
        /// This method creates an event log with one case.
        /// </summary>
        /// <autor>Thomas Meents</autor>
        public static EventLog OneCaseEventLog()
        {
            Event firstEvent = new Event("first");
            Event secondEvent = new Event("second");
            List<Event> listOfEvents = new List<Event> { firstEvent, secondEvent };
            Case ca = new Case("ExampleCase", listOfEvents);
            EventLog eventLog = new EventLog();
            eventLog.Cases.Add(ca);

            return eventLog;
        }
        public void CheckCorrectFitnessBetweenEventLogAndPetrinetTest1()
        {
            //
            //EventLog
            //
            //create Case1
            Case ca1 = new Case();
            ca1.CreateEvent("A");
            ca1.CreateEvent("C");
            ca1.CreateEvent("D");
            ca1.CreateEvent("E");
            ca1.CreateEvent("H");

            //create Case2
            Case ca2 = new Case();
            ca2.CreateEvent("A");
            ca2.CreateEvent("B");
            ca2.CreateEvent("D");
            ca2.CreateEvent("E");
            ca2.CreateEvent("G");

            //create Case3
            Case ca3 = new Case();
            ca3.CreateEvent("A");
            ca3.CreateEvent("D");
            ca3.CreateEvent("C");
            ca3.CreateEvent("E");
            ca3.CreateEvent("H");

            //create Case4
            Case ca4 = new Case();
            ca4.CreateEvent("A");
            ca4.CreateEvent("B");
            ca4.CreateEvent("D");
            ca4.CreateEvent("E");
            ca4.CreateEvent("H");

            //create Case5
            Case ca5 = new Case();
            ca5.CreateEvent("A");
            ca5.CreateEvent("C");
            ca5.CreateEvent("D");
            ca5.CreateEvent("E");
            ca5.CreateEvent("G");

            //create Case6
            Case ca6 = new Case();
            ca6.CreateEvent("A");
            ca6.CreateEvent("D");
            ca6.CreateEvent("C");
            ca6.CreateEvent("E");
            ca6.CreateEvent("G");

            //create Case7
            Case ca7 = new Case();
            ca7.CreateEvent("A");
            ca7.CreateEvent("D");
            ca7.CreateEvent("B");
            ca7.CreateEvent("E");
            ca7.CreateEvent("H");

            //create Case8
            Case ca8 = new Case();
            ca8.CreateEvent("A");
            ca8.CreateEvent("C");
            ca8.CreateEvent("D");
            ca8.CreateEvent("E");
            ca8.CreateEvent("F");
            ca8.CreateEvent("D");
            ca8.CreateEvent("B");
            ca8.CreateEvent("E");
            ca8.CreateEvent("H");

            //create Case9
            Case ca9 = new Case();
            ca9.CreateEvent("A");
            ca9.CreateEvent("D");
            ca9.CreateEvent("B");
            ca9.CreateEvent("E");
            ca9.CreateEvent("G");

            //create Case10
            Case ca10 = new Case();
            ca10.CreateEvent("A");
            ca10.CreateEvent("C");
            ca10.CreateEvent("D");
            ca10.CreateEvent("E");
            ca10.CreateEvent("F");
            ca10.CreateEvent("B");
            ca10.CreateEvent("D");
            ca10.CreateEvent("E");
            ca10.CreateEvent("H");

            //create Case11
            Case ca11 = new Case();
            ca11.CreateEvent("A");
            ca11.CreateEvent("C");
            ca11.CreateEvent("D");
            ca11.CreateEvent("E");
            ca11.CreateEvent("F");
            ca11.CreateEvent("B");
            ca11.CreateEvent("D");
            ca11.CreateEvent("E");
            ca11.CreateEvent("G");

            //create Case12
            Case ca12 = new Case();
            ca12.CreateEvent("A");
            ca12.CreateEvent("C");
            ca12.CreateEvent("D");
            ca12.CreateEvent("E");
            ca12.CreateEvent("F");
            ca12.CreateEvent("D");
            ca12.CreateEvent("B");
            ca12.CreateEvent("E");
            ca12.CreateEvent("G");

            //create Case13
            Case ca13 = new Case();
            ca13.CreateEvent("A");
            ca13.CreateEvent("D");
            ca13.CreateEvent("C");
            ca13.CreateEvent("E");
            ca13.CreateEvent("F");
            ca13.CreateEvent("C");
            ca13.CreateEvent("D");
            ca13.CreateEvent("E");
            ca13.CreateEvent("H");

            //create Case14
            Case ca14 = new Case();
            ca14.CreateEvent("A");
            ca14.CreateEvent("D");
            ca14.CreateEvent("C");
            ca14.CreateEvent("E");
            ca14.CreateEvent("F");
            ca14.CreateEvent("D");
            ca14.CreateEvent("B");
            ca14.CreateEvent("E");
            ca14.CreateEvent("H");

            //create Case15
            Case ca15 = new Case();
            ca15.CreateEvent("A");
            ca15.CreateEvent("D");
            ca15.CreateEvent("C");
            ca15.CreateEvent("E");
            ca15.CreateEvent("F");
            ca15.CreateEvent("B");
            ca15.CreateEvent("D");
            ca15.CreateEvent("E");
            ca15.CreateEvent("G");

            //create Case16
            Case ca16 = new Case();
            ca16.CreateEvent("A");
            ca16.CreateEvent("C");
            ca16.CreateEvent("D");
            ca16.CreateEvent("E");
            ca16.CreateEvent("F");
            ca16.CreateEvent("B");
            ca16.CreateEvent("D");
            ca16.CreateEvent("E");
            ca16.CreateEvent("F");
            ca16.CreateEvent("D");
            ca16.CreateEvent("B");
            ca16.CreateEvent("E");
            ca16.CreateEvent("G");

            //create Case17
            Case ca17 = new Case();
            ca17.CreateEvent("A");
            ca17.CreateEvent("D");
            ca17.CreateEvent("C");
            ca17.CreateEvent("E");
            ca17.CreateEvent("F");
            ca17.CreateEvent("D");
            ca17.CreateEvent("B");
            ca17.CreateEvent("E");
            ca17.CreateEvent("G");

            //create Case18
            Case ca18 = new Case();
            ca18.CreateEvent("A");
            ca18.CreateEvent("D");
            ca18.CreateEvent("C");
            ca18.CreateEvent("E");
            ca18.CreateEvent("F");
            ca18.CreateEvent("B");
            ca18.CreateEvent("D");
            ca18.CreateEvent("E");
            ca18.CreateEvent("F");
            ca18.CreateEvent("B");
            ca18.CreateEvent("D");
            ca18.CreateEvent("E");
            ca18.CreateEvent("G");

            //create Case19
            Case ca19 = new Case();
            ca19.CreateEvent("A");
            ca19.CreateEvent("D");
            ca19.CreateEvent("C");
            ca19.CreateEvent("E");
            ca19.CreateEvent("F");
            ca19.CreateEvent("D");
            ca19.CreateEvent("B");
            ca19.CreateEvent("E");
            ca19.CreateEvent("F");
            ca19.CreateEvent("B");
            ca19.CreateEvent("D");
            ca19.CreateEvent("E");
            ca19.CreateEvent("H");

            //create Case20
            Case ca20 = new Case();
            ca20.CreateEvent("A");
            ca20.CreateEvent("D");
            ca20.CreateEvent("B");
            ca20.CreateEvent("E");
            ca20.CreateEvent("F");
            ca20.CreateEvent("B");
            ca20.CreateEvent("D");
            ca20.CreateEvent("E");
            ca20.CreateEvent("F");
            ca20.CreateEvent("D");
            ca20.CreateEvent("B");
            ca20.CreateEvent("E");
            ca20.CreateEvent("G");

            //create Case21
            Case ca21 = new Case();
            ca21.CreateEvent("A");
            ca21.CreateEvent("D");
            ca21.CreateEvent("C");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("D");
            ca21.CreateEvent("B");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("C");
            ca21.CreateEvent("D");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("D");
            ca21.CreateEvent("B");
            ca21.CreateEvent("E");
            ca21.CreateEvent("G");

            //create Event Log
            EventLog eventLog = new EventLog();
            eventLog.Cases.Add(ca1);
            eventLog.Cases.Add(ca2);
            eventLog.Cases.Add(ca3);
            eventLog.Cases.Add(ca4);
            eventLog.Cases.Add(ca5);
            eventLog.Cases.Add(ca6);
            eventLog.Cases.Add(ca7);
            eventLog.Cases.Add(ca8);
            eventLog.Cases.Add(ca9);
            eventLog.Cases.Add(ca10);
            eventLog.Cases.Add(ca11);
            eventLog.Cases.Add(ca12);
            eventLog.Cases.Add(ca13);
            eventLog.Cases.Add(ca14);
            eventLog.Cases.Add(ca15);
            eventLog.Cases.Add(ca16);
            eventLog.Cases.Add(ca17);
            eventLog.Cases.Add(ca18);
            eventLog.Cases.Add(ca19);
            eventLog.Cases.Add(ca20);
            eventLog.Cases.Add(ca21);

            //
            //PetriNet
            //
            PetriNet petriNet = new PetriNet("Petri-Net Name");

            Place pStart = new Place("Place Start", 0);
            Place pC1 = new Place("c1", 0);
            Place pC2 = new Place("c2", 0);
            Place pC3 = new Place("c3", 0);
            Place pC4 = new Place("c4", 0);
            Place pC5 = new Place("c5", 0);
            Place pEnd = new Place("Place End", 0);

            Transition tA = new Transition("A");
            Transition tB = new Transition("B");
            Transition tC = new Transition("C");
            Transition tD = new Transition("D");
            Transition tE = new Transition("E");
            Transition tF = new Transition("F");
            Transition tG = new Transition("G");
            Transition tH = new Transition("H");

            tG.AddOutgoingPlace(pEnd);
            tG.AddIncomingPlace(pC5);

            tH.AddOutgoingPlace(pEnd);
            tH.AddIncomingPlace(pC5);

            tE.AddIncomingPlace(pC3);
            tE.AddIncomingPlace(pC4);
            tE.AddOutgoingPlace(pC5);

            pC3.AppendIncomingTransition(tB);
            pC3.AppendIncomingTransition(tC);
            pC3.AppendOutgoingTransition(tE);

            pC4.AppendOutgoingTransition(tE);

            tB.AddIncomingPlace(pC1);
            tB.AddOutgoingPlace(pC3);

            tC.AddIncomingPlace(pC1);
            tC.AddOutgoingPlace(pC3);

            tD.AddIncomingPlace(pC2);
            tD.AddOutgoingPlace(pC4);

            pC1.AppendIncomingTransition(tA);
            pC1.AppendOutgoingTransition(tB);
            pC1.AppendOutgoingTransition(tC);

            pC2.AppendIncomingTransition(tA);
            pC2.AppendOutgoingTransition(tD);

            tF.AddIncomingPlace(pC5);
            tF.AddOutgoingPlace(pC1);
            tF.AddOutgoingPlace(pC2);

            //
            tA.AddIncomingPlace(pStart);
            tA.AddOutgoingPlace(pC1);
            tA.AddOutgoingPlace(pC2);

            pStart.AppendOutgoingTransition(tA);

            pEnd.AppendIncomingTransition(tG);
            pEnd.AppendIncomingTransition(tH);

            ////
            petriNet.Transitions.Add(tA);
            petriNet.Transitions.Add(tB);
            petriNet.Transitions.Add(tC);
            petriNet.Transitions.Add(tD);
            petriNet.Transitions.Add(tE);
            petriNet.Transitions.Add(tF);
            petriNet.Transitions.Add(tG);
            petriNet.Transitions.Add(tH);

            ////
            petriNet.Places.Add(pStart);
            petriNet.Places.Add(pC1);
            petriNet.Places.Add(pC2);
            petriNet.Places.Add(pC3);
            petriNet.Places.Add(pC4);
            petriNet.Places.Add(pC5);
            petriNet.Places.Add(pEnd);

            ComparingFootprintResultMatrix matrix = new ComparingFootprintResultMatrix(ComparingFootprintAlgorithm.CreateFootprint(eventLog), ComparingFootprintAlgorithm.CreateFootprint(petriNet));
            double fitness = ComparingFootprintAlgorithm.CalculateFitness(matrix.GetNumberOfDifferences(), matrix.GetNumberOfOpportunities());

            if (Math.Abs(fitness - 1.0) > 0.0001)
            {
                Assert.Fail("Fitness not correct! (" + fitness + ")");
            }
        }
        /// <summary>
        /// This method creates an event log with one case.
        /// </summary>
        /// <autor>Andrej Albrecht, Markus Holznagel</autor>
        public static EventLog OneCaseEventLogWithFourOrderedEvents()
        {
            //Create case
            Case ca = new Case();
            ca.CreateEvent("A");
            ca.CreateEvent("B");
            ca.CreateEvent("C");
            ca.CreateEvent("D");

            //Create event log
            EventLog eventLog = new EventLog();

            return eventLog;
        }
        public void CompareEventLogAndPetriNetTest1()
        {
            //
            //EventLog
            //
            //create Case1
            Case ca1 = new Case();
            ca1.CreateEvent("A");
            ca1.CreateEvent("C");
            ca1.CreateEvent("D");
            ca1.CreateEvent("E");
            ca1.CreateEvent("H");

            //create Case2
            Case ca2 = new Case();
            ca2.CreateEvent("A");
            ca2.CreateEvent("B");
            ca2.CreateEvent("D");
            ca2.CreateEvent("E");
            ca2.CreateEvent("G");

            //create Case3
            Case ca3 = new Case();
            ca3.CreateEvent("A");
            ca3.CreateEvent("D");
            ca3.CreateEvent("C");
            ca3.CreateEvent("E");
            ca3.CreateEvent("H");

            //create Case4
            Case ca4 = new Case();
            ca4.CreateEvent("A");
            ca4.CreateEvent("B");
            ca4.CreateEvent("D");
            ca4.CreateEvent("E");
            ca4.CreateEvent("H");

            //create Case5
            Case ca5 = new Case();
            ca5.CreateEvent("A");
            ca5.CreateEvent("C");
            ca5.CreateEvent("D");
            ca5.CreateEvent("E");
            ca5.CreateEvent("G");

            //create Case6
            Case ca6 = new Case();
            ca6.CreateEvent("A");
            ca6.CreateEvent("D");
            ca6.CreateEvent("C");
            ca6.CreateEvent("E");
            ca6.CreateEvent("G");

            //create Case7
            Case ca7 = new Case();
            ca7.CreateEvent("A");
            ca7.CreateEvent("D");
            ca7.CreateEvent("B");
            ca7.CreateEvent("E");
            ca7.CreateEvent("H");

            //create Case8
            Case ca8 = new Case();
            ca8.CreateEvent("A");
            ca8.CreateEvent("C");
            ca8.CreateEvent("D");
            ca8.CreateEvent("E");
            ca8.CreateEvent("F");
            ca8.CreateEvent("D");
            ca8.CreateEvent("B");
            ca8.CreateEvent("E");
            ca8.CreateEvent("H");

            //create Case9
            Case ca9 = new Case();
            ca9.CreateEvent("A");
            ca9.CreateEvent("D");
            ca9.CreateEvent("B");
            ca9.CreateEvent("E");
            ca9.CreateEvent("G");

            //create Case10
            Case ca10 = new Case();
            ca10.CreateEvent("A");
            ca10.CreateEvent("C");
            ca10.CreateEvent("D");
            ca10.CreateEvent("E");
            ca10.CreateEvent("F");
            ca10.CreateEvent("B");
            ca10.CreateEvent("D");
            ca10.CreateEvent("E");
            ca10.CreateEvent("H");

            //create Case11
            Case ca11 = new Case();
            ca11.CreateEvent("A");
            ca11.CreateEvent("C");
            ca11.CreateEvent("D");
            ca11.CreateEvent("E");
            ca11.CreateEvent("F");
            ca11.CreateEvent("B");
            ca11.CreateEvent("D");
            ca11.CreateEvent("E");
            ca11.CreateEvent("G");

            //create Case12
            Case ca12 = new Case();
            ca12.CreateEvent("A");
            ca12.CreateEvent("C");
            ca12.CreateEvent("D");
            ca12.CreateEvent("E");
            ca12.CreateEvent("F");
            ca12.CreateEvent("D");
            ca12.CreateEvent("B");
            ca12.CreateEvent("E");
            ca12.CreateEvent("G");

            //create Case13
            Case ca13 = new Case();
            ca13.CreateEvent("A");
            ca13.CreateEvent("D");
            ca13.CreateEvent("C");
            ca13.CreateEvent("E");
            ca13.CreateEvent("F");
            ca13.CreateEvent("C");
            ca13.CreateEvent("D");
            ca13.CreateEvent("E");
            ca13.CreateEvent("H");

            //create Case14
            Case ca14 = new Case();
            ca14.CreateEvent("A");
            ca14.CreateEvent("D");
            ca14.CreateEvent("C");
            ca14.CreateEvent("E");
            ca14.CreateEvent("F");
            ca14.CreateEvent("D");
            ca14.CreateEvent("B");
            ca14.CreateEvent("E");
            ca14.CreateEvent("H");

            //create Case15
            Case ca15 = new Case();
            ca15.CreateEvent("A");
            ca15.CreateEvent("D");
            ca15.CreateEvent("C");
            ca15.CreateEvent("E");
            ca15.CreateEvent("F");
            ca15.CreateEvent("B");
            ca15.CreateEvent("D");
            ca15.CreateEvent("E");
            ca15.CreateEvent("G");

            //create Case16
            Case ca16 = new Case();
            ca16.CreateEvent("A");
            ca16.CreateEvent("C");
            ca16.CreateEvent("D");
            ca16.CreateEvent("E");
            ca16.CreateEvent("F");
            ca16.CreateEvent("B");
            ca16.CreateEvent("D");
            ca16.CreateEvent("E");
            ca16.CreateEvent("F");
            ca16.CreateEvent("D");
            ca16.CreateEvent("B");
            ca16.CreateEvent("E");
            ca16.CreateEvent("G");

            //create Case17
            Case ca17 = new Case();
            ca17.CreateEvent("A");
            ca17.CreateEvent("D");
            ca17.CreateEvent("C");
            ca17.CreateEvent("E");
            ca17.CreateEvent("F");
            ca17.CreateEvent("D");
            ca17.CreateEvent("B");
            ca17.CreateEvent("E");
            ca17.CreateEvent("G");

            //create Case18
            Case ca18 = new Case();
            ca18.CreateEvent("A");
            ca18.CreateEvent("D");
            ca18.CreateEvent("C");
            ca18.CreateEvent("E");
            ca18.CreateEvent("F");
            ca18.CreateEvent("B");
            ca18.CreateEvent("D");
            ca18.CreateEvent("E");
            ca18.CreateEvent("F");
            ca18.CreateEvent("B");
            ca18.CreateEvent("D");
            ca18.CreateEvent("E");
            ca18.CreateEvent("G");

            //create Case19
            Case ca19 = new Case();
            ca19.CreateEvent("A");
            ca19.CreateEvent("D");
            ca19.CreateEvent("C");
            ca19.CreateEvent("E");
            ca19.CreateEvent("F");
            ca19.CreateEvent("D");
            ca19.CreateEvent("B");
            ca19.CreateEvent("E");
            ca19.CreateEvent("F");
            ca19.CreateEvent("B");
            ca19.CreateEvent("D");
            ca19.CreateEvent("E");
            ca19.CreateEvent("H");

            //create Case20
            Case ca20 = new Case();
            ca20.CreateEvent("A");
            ca20.CreateEvent("D");
            ca20.CreateEvent("B");
            ca20.CreateEvent("E");
            ca20.CreateEvent("F");
            ca20.CreateEvent("B");
            ca20.CreateEvent("D");
            ca20.CreateEvent("E");
            ca20.CreateEvent("F");
            ca20.CreateEvent("D");
            ca20.CreateEvent("B");
            ca20.CreateEvent("E");
            ca20.CreateEvent("G");

            //create Case21
            Case ca21 = new Case();
            ca21.CreateEvent("A");
            ca21.CreateEvent("D");
            ca21.CreateEvent("C");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("D");
            ca21.CreateEvent("B");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("C");
            ca21.CreateEvent("D");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("D");
            ca21.CreateEvent("B");
            ca21.CreateEvent("E");
            ca21.CreateEvent("G");

            //create Event Log
            EventLog eventLog = new EventLog();
            eventLog.Cases.Add(ca1);
            eventLog.Cases.Add(ca2);
            eventLog.Cases.Add(ca3);
            eventLog.Cases.Add(ca4);
            eventLog.Cases.Add(ca5);
            eventLog.Cases.Add(ca6);
            eventLog.Cases.Add(ca7);
            eventLog.Cases.Add(ca8);
            eventLog.Cases.Add(ca9);
            eventLog.Cases.Add(ca10);
            eventLog.Cases.Add(ca11);
            eventLog.Cases.Add(ca12);
            eventLog.Cases.Add(ca13);
            eventLog.Cases.Add(ca14);
            eventLog.Cases.Add(ca15);
            eventLog.Cases.Add(ca16);
            eventLog.Cases.Add(ca17);
            eventLog.Cases.Add(ca18);
            eventLog.Cases.Add(ca19);
            eventLog.Cases.Add(ca20);
            eventLog.Cases.Add(ca21);

            //
            //PetriNet
            //
            PetriNet petriNet = new PetriNet("Petri-Net Name");

            Place pStart = new Place("Place Start", 0);
            Place pC1 = new Place("c1", 0);
            Place pC2 = new Place("c2", 0);
            Place pC3 = new Place("c3", 0);
            Place pC4 = new Place("c4", 0);
            Place pC5 = new Place("c5", 0);
            Place pEnd = new Place("Place End", 0);

            Transition tA = new Transition("A");
            Transition tB = new Transition("B");
            Transition tC = new Transition("C");
            Transition tD = new Transition("D");
            Transition tE = new Transition("E");
            Transition tF = new Transition("F");
            Transition tG = new Transition("G");
            Transition tH = new Transition("H");

            tG.AddOutgoingPlace(pEnd);
            tG.AddIncomingPlace(pC5);

            tH.AddOutgoingPlace(pEnd);
            tH.AddIncomingPlace(pC5);

            tE.AddIncomingPlace(pC3);
            tE.AddIncomingPlace(pC4);
            tE.AddOutgoingPlace(pC5);

            pC3.AppendIncomingTransition(tB);
            pC3.AppendIncomingTransition(tC);
            pC3.AppendOutgoingTransition(tE);

            pC4.AppendIncomingTransition(tD);
            pC4.AppendOutgoingTransition(tE);

            tB.AddIncomingPlace(pC1);
            tB.AddOutgoingPlace(pC3);

            tC.AddIncomingPlace(pC1);
            tC.AddOutgoingPlace(pC3);

            tD.AddIncomingPlace(pC2);
            tD.AddOutgoingPlace(pC4);

            pC1.AppendIncomingTransition(tA);
            pC1.AppendOutgoingTransition(tB);
            pC1.AppendOutgoingTransition(tC);

            pC2.AppendIncomingTransition(tA);
            pC2.AppendOutgoingTransition(tD);

            tF.AddIncomingPlace(pC5);
            tF.AddOutgoingPlace(pC1);
            tF.AddOutgoingPlace(pC2);

            //
            tA.AddIncomingPlace(pStart);
            tA.AddOutgoingPlace(pC1);
            tA.AddOutgoingPlace(pC2);

            pStart.AppendOutgoingTransition(tA);

            pEnd.AppendIncomingTransition(tG);
            pEnd.AppendIncomingTransition(tH);

            ////
            petriNet.Transitions.Add(tA);
            petriNet.Transitions.Add(tB);
            petriNet.Transitions.Add(tC);
            petriNet.Transitions.Add(tD);
            petriNet.Transitions.Add(tE);
            petriNet.Transitions.Add(tF);
            petriNet.Transitions.Add(tG);
            petriNet.Transitions.Add(tH);

            ////
            petriNet.Places.Add(pStart);
            petriNet.Places.Add(pC1);
            petriNet.Places.Add(pC2);
            petriNet.Places.Add(pC3);
            petriNet.Places.Add(pC4);
            petriNet.Places.Add(pC5);
            petriNet.Places.Add(pEnd);

            ComparingFootprint footprintEventLog = ComparingFootprintAlgorithm.CreateFootprint(eventLog);
            ComparingFootprint footprintPetriNet = ComparingFootprintAlgorithm.CreateFootprint(petriNet);

            ComparingFootprintResultMatrix footprintResultMatrix = new ComparingFootprintResultMatrix(footprintEventLog, footprintPetriNet);

            if (footprintResultMatrix.HeaderWithEventNames.Count != 8)
            {
                Assert.Fail("");
            }

            int y = 0;
            foreach (String headerNameY in footprintResultMatrix.HeaderWithEventNames)
            {
                int x = 0;
                foreach (String headerNameX in footprintResultMatrix.HeaderWithEventNames)
                {
                    ResultCellType resultCellType = footprintResultMatrix.ResultMatrix[y, x];
                    Console.WriteLine("Test headerNameY: " + headerNameY + ", headerNameX: " + headerNameX + " [" + y + "," + x + "].CellType:" + resultCellType);

                    if (!resultCellType.Equals(ResultCellType.NoDifferences))
                    {
                        Assert.Fail("Test headerNameY: " + headerNameY + ", headerNameX: " + headerNameX + " [" + y + "," + x + "].CellType:" + resultCellType);
                    }

                    x++;
                }
                y++;
            }

            //Arrange (Create Footprints)
            ComparingFootprint footPrintEventlog = ComparingFootprintAlgorithm.CreateFootprint(eventLog);
            ComparingFootprint footPrintPetrinet = ComparingFootprintAlgorithm.CreateFootprint(petriNet);
            ComparingFootprintResultMatrix resultFootprint = new ComparingFootprintResultMatrix(footPrintEventlog, footPrintPetrinet);

            // Act (Calculate Fitness)
            double fitnessComparingFootprint = ComparingFootprintAlgorithm.CalculateFitness(resultFootprint.GetNumberOfDifferences(), resultFootprint.GetNumberOfOpportunities());

            if (fitnessComparingFootprint != 1.0)
            {
                // Assert
                Assert.Fail("Fitness not correct! (" + fitnessComparingFootprint + ")");
            }
        }
        /// <summary>
        /// This method creates an event log with two cases.
        /// </summary>
        /// <autor>Markus Holznagel</autor>
        public static EventLog TwoCaseEventLog()
        {
            //Create case1
            Case ca = new Case();
            ca.CreateEvent("A");
            ca.CreateEvent("B");
            ca.CreateEvent("C");
            ca.CreateEvent("D");

            //Create case2
            Case ca2 = new Case();
            ca2.CreateEvent("A");
            ca2.CreateEvent("C");
            ca2.CreateEvent("B");
            ca2.CreateEvent("D");

            //Create event log
            EventLog eventLog = new EventLog();
            eventLog.Cases.Add(ca);
            eventLog.Cases.Add(ca2);

            return eventLog;
        }
        /// <summary>
        /// Reads the Events from the Database and returns a DataSet.
        /// </summary>
        /// <returns>A list of Fact-objects.</returns>
        /// <author>Jannik Arndt, Bernd Nottbeck</author>
        public List<List<Case>> GetFacts(string sqlcode)
        {
            var listOfFacts = new List<List<Case>>();

            try
            {
                // Loads a list of all facts and then converts it into fact-, case- and event-objects.
                Open();

                var factDataTable = GetFactDataTable(sqlcode);

                var currentFactID = "";
                var currentCaseID = "";
                List<Case> currentFact = null;
                Case currentCase = null;

                // iterate over the FactDataTable: object with the same fact_id will be combined into one fact-object.
                foreach (DataRow row in factDataTable.Rows)
                {
                    // 1. Did a new fact start?
                    if (currentFactID != row[ColumnNameFactID].ToString())
                    {
                        // save the current one
                        if (currentFact != null)
                            listOfFacts.Add(currentFact);

                        // and create a new one
                        currentFactID = row[ColumnNameFactID].ToString();
                        currentFact = new List<Case>();
                    }

                    // 2. Did a new case start?
                    if (currentCaseID != row[ColumnNameCaseID].ToString())
                    {
                        currentCaseID = row[ColumnNameCaseID].ToString();
                        currentCase = new Case(currentCaseID);
                        currentCase.AdditionalData.Add(ColumnNameFactID, row[ColumnNameFactID].ToString());
                        if (Settings.Default.JoinAllDimensions)
                            foreach (var dimension in DBWorker.MetaData.ListOfFactDimensions)
                                if (!dimension.IsEmptyDimension)
                                    currentCase.AdditionalData.Add(dimension.ToTable, row[dimension.ToTable].ToString());

                        if (currentFact != null)
                            currentFact.Add(currentCase);
                    }

                    // 3. create an event and add it to the case
                    var currentEvent = new Event(row[DBWorker.MetaData.EventClassifier].ToString());
                    foreach (var columnName in DBWorker.MetaData.ListOfEventsTableColumnNames)
                        currentEvent.Information.Add(columnName, row[columnName].ToString());

                    if (currentCase != null)
                        currentCase.EventList.Add(currentEvent);
                }
                // since the last case and fact are not saved yet, we need to do this now.
                listOfFacts.Add(currentFact);

                return listOfFacts;
            }
            finally
            {
                Close();
            }
        }