Last change
on this file since 16997 was
16997,
checked in by gkronber, 5 years ago
|
#2520 Update plugin dependencies and references for Core.Views and Optimizer for new persistence
|
File size:
1.3 KB
|
Rev | Line | |
---|
[16908] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using HEAL.Attic;
|
---|
| 5 | using HeuristicLab.PluginInfrastructure;
|
---|
| 6 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
---|
| 7 |
|
---|
| 8 | namespace HeuristicLab.Tests.Persistence.Attic {
|
---|
| 9 | [TestClass]
|
---|
| 10 | public class PersistenceConsistencyChecks {
|
---|
| 11 | [TestCategory("Persistence.Attic")]
|
---|
| 12 | [TestCategory("Essential")]
|
---|
| 13 | [TestProperty("Time", "short")]
|
---|
| 14 | [TestMethod]
|
---|
| 15 | public void CheckDuplicateGUIDs() {
|
---|
| 16 | // easy to produce duplicate GUIDs with copy&paste
|
---|
| 17 |
|
---|
| 18 | var dict = new Dictionary<Guid, string>();
|
---|
| 19 | var duplicates = new Dictionary<string, string>();
|
---|
| 20 | foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(object))) {
|
---|
| 21 | var attr = StorableTypeAttribute.GetStorableTypeAttribute(type);
|
---|
| 22 | if (attr == null)
|
---|
| 23 | continue;
|
---|
| 24 |
|
---|
| 25 | foreach (var guid in attr.Guids) {
|
---|
| 26 | if (!dict.ContainsKey(guid)) {
|
---|
| 27 | dict.Add(guid, type.FullName);
|
---|
| 28 | } else {
|
---|
| 29 | duplicates.Add(type.FullName, dict[guid]);
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | foreach (var kvp in duplicates) {
|
---|
| 35 | Console.WriteLine($"{kvp.Key} has same GUID as {kvp.Value}");
|
---|
| 36 | }
|
---|
| 37 | if (duplicates.Any()) Assert.Fail("Duplicate GUIDs found.");
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.