/// <summary> /// Shows only the cells in a footprint in which the given transitionname appears /// </summary> /// <param name="transitionName">Transitionname</param> /// <param name="footPrint">Footprint</param> /// <returns>Returns the stripped footprint</returns> /// <autor>Andrej Albrecht</autor> private static ComparingFootprintResultMatrix StripFootprintForTransition(String transitionName, ComparingFootprintResultMatrix footPrint) { List<String> headerWithEventNames = new List<String>(); //save the needed header names for (int row = 0; row < footPrint.HeaderWithEventNames.Count; row++) for (int column = 0; column < footPrint.HeaderWithEventNames.Count; column++) if (!footPrint.ResultMatrix[row, column].Equals(ResultCellType.NoDifferences) && (footPrint.HeaderWithEventNames[row].Equals(transitionName) || footPrint.HeaderWithEventNames[column].Equals(transitionName))) { headerWithEventNames.Add(footPrint.HeaderWithEventNames[row]); headerWithEventNames.Add(footPrint.HeaderWithEventNames[column]); } //create new Footprint ComparingFootprintResultMatrix newFootPrint = new ComparingFootprintResultMatrix(); newFootPrint.AddEventHeader(headerWithEventNames); ResultCellType[,] resultMatrix = new ResultCellType[newFootPrint.HeaderWithEventNames.Count, newFootPrint.HeaderWithEventNames.Count]; var header1 = newFootPrint.HeaderWithEventNames; var header2 = footPrint.HeaderWithEventNames; //fill the new footprint matrix with the required values for (int leftRow = 0; leftRow < header1.Count; leftRow++) for (int leftColumn = 0; leftColumn < header1.Count; leftColumn++) for (int rightRow = 0; rightRow < header2.Count; rightRow++) for (int rightColumn = 0; rightColumn < header2.Count; rightColumn++) if (header1[leftRow].Equals(header2[rightRow]) && header1[leftColumn].Equals(header2[rightColumn])) resultMatrix[leftRow, leftColumn] = footPrint.ResultMatrix[rightRow, rightColumn]; newFootPrint.ResultMatrix = resultMatrix; return newFootPrint; }
public void AddEventHeader_WithEventNames_Test() { // Arrange //create a Test Footprint header EventLog eventLog_test = EventLogExample.OneCaseEventLogWithFourOrderedEvents(); ComparingFootprintResultMatrix foot = new ComparingFootprintResultMatrix(); List<string> listWithStrings = new List<string> {"A", "B", "C", "D"}; foot.AddEventHeader(listWithStrings); //Act foreach (string eventTest in foot.HeaderWithEventNames){ if (eventTest.Equals("A") || eventTest.Equals("B") || eventTest.Equals("C") || eventTest.Equals("D")) { } else { Assert.Fail(eventTest + " is not in list"); } } }