Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17019


Ignore:
Timestamp:
06/18/19 16:59:14 (6 years ago)
Author:
abeham
Message:

#2520: fixed unit test to check for duplicate GUIDs (includes NonDiscoverable types)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Tests/HeuristicLab.Persistence.Attic/PersistenceConsistencyChecks.cs

    r16997 r17019  
    33using System.Linq;
    44using HEAL.Attic;
    5 using HeuristicLab.PluginInfrastructure;
    65using Microsoft.VisualStudio.TestTools.UnitTesting;
    76
     
    1514    public void CheckDuplicateGUIDs() {
    1615      // easy to produce duplicate GUIDs with copy&paste
    17 
    1816      var dict = new Dictionary<Guid, string>();
    1917      var duplicates = new Dictionary<string, string>();
    20       foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(object))) {
     18      // using AppDomain instead of ApplicationManager so that NonDiscoverableTypes are also checked
     19      foreach (Type type in AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes())) {
    2120        var attr = StorableTypeAttribute.GetStorableTypeAttribute(type);
    2221        if (attr == null)
     
    3534        Console.WriteLine($"{kvp.Key} has same GUID as {kvp.Value}");
    3635      }
     36
    3737      if (duplicates.Any()) Assert.Fail("Duplicate GUIDs found.");
    3838    }
Note: See TracChangeset for help on using the changeset viewer.