public void CompareProcessModelsTest1() { IDifference diff = DiffFactory.CreateDifferenceObject <SnapshotDiff>(); PetriNet onetwothreefourfive = ExampleData.PetriNetExample.OneTwoThreeFourFive(); PetriNet onethreefive = ExampleData.PetriNetExample.OneThreeFive(); List <ProcessModel> listOfProcessModels = new List <ProcessModel> { onetwothreefourfive, onethreefive }; //ProcessModel resultModel = SnapshotDiff.CompareProcessModels(listOfProcessModels); ProcessModel resultModel = diff.CompareProcessModels(listOfProcessModels); PetriNet result = resultModel as PetriNet; Assert.IsTrue(result != null && result.Transitions.Count == 5, "Transitions: " + result.Transitions.Count); Assert.IsTrue(result != null && result.Places.Count == 6, "Places: " + result.Places.Count); }
/// <summary> /// Compares two or three process models /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <author>Thomas Meents, Christopher Licht</author> private void CompareClick(object sender, RoutedEventArgs e) { switch (ListOfChoosenProcessModels.Count) { case 2: { try { IDifference diff = DiffFactory.CreateDifferenceObject <SnapshotDiff>(); Field diffField = new Field { ProcessModel = diff.CompareProcessModels(ListOfChoosenProcessModels) }; if (diffField.ProcessModel != null && diffField.ProcessModel.GetType() == typeof(PetriNet)) { String title = String.Join(", ", ListOfChoosenProcessModels.Select(pm => pm.Name)); ModernWindow pmDiffWindow = new ModernWindow { Style = (Style)Application.Current.Resources["EmptyWindow"], Width = 1000, Height = 600, Owner = Application.Current.MainWindow, Title = title }; pmDiffWindow.Content = new PMViewer(diffField, pmDiffWindow, true, title); pmDiffWindow.Show(); } } catch (Exception Ex) { ErrorHandling.ReportErrorToUser("Error: " + Ex.Message); } } break; case 0: ModernDialog.ShowMessage("No process model checkboxes are checked", "Tip", MessageBoxButton.OK); break; default: ModernDialog.ShowMessage("Only two process models can be compared.\nCheck some checkboxes and click Compare to see the differences.", "Tip", MessageBoxButton.OK); break; } }
public void CompareProcessModelsTest() { IDifference diff = DiffFactory.CreateDifferenceObject <SnapshotDiff>(); PetriNet onetwothreefourfive = ExampleData.PetriNetExample.OneTwoThreeFourFive(); PetriNet onethreefive = ExampleData.PetriNetExample.OneThreeFive(); List <ProcessModel> listOfProcessModels = new List <ProcessModel> { onetwothreefourfive, onethreefive }; //ProcessModel resultModel = SnapshotDiff.CompareProcessModels(listOfProcessModels); ProcessModel resultModel = diff.CompareProcessModels(listOfProcessModels); PetriNet result = resultModel as PetriNet; Assert.IsTrue(result != null && result.Transitions.Count(transition => transition.DiffStatus == DiffState.Added) == 0); Assert.IsTrue(result != null && result.Transitions.Count(transition => transition.DiffStatus == DiffState.Changed) == 0); Assert.IsTrue(result != null && result.Transitions.Count(transition => transition.DiffStatus == DiffState.Deleted) == 2); Assert.IsTrue(result != null && result.Transitions.Count(transition => transition.DiffStatus == DiffState.Unchanged) == 3); }