Changeset 17781
- Timestamp:
- 11/18/20 10:58:03 (4 years ago)
- Location:
- trunk/HeuristicLab.Tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Tests/HeuristicLab-3.3/PluginDependenciesTest.cs
r17180 r17781 39 39 [ClassInitialize] 40 40 public static void MyClassInitialize(TestContext testContext) { 41 loadedPlugins = PluginLoader.Assemblies.Where(PluginLoader.IsPluginAssembly).ToDictionary(a => a, GetPluginFromAssembly); 41 try { 42 loadedPlugins = PluginLoader.Assemblies.Where(PluginLoader.IsPluginAssembly).ToDictionary(a => a, GetPluginFromAssembly); 43 } catch (BadImageFormatException e) { 44 var message = string.Join(Environment.NewLine, "Could not load all types. Check if test process architecture is set to x64.", string.Empty, "Exception:", e); 45 Assert.Fail(message); 46 } 47 42 48 pluginNames = loadedPlugins.ToDictionary(a => a.Key.GetName().FullName, a => GetPluginName(a.Value)); 43 49 -
trunk/HeuristicLab.Tests/HeuristicLab.Persistence.Attic/PersistenceConsistencyChecks.cs
r17019 r17781 2 2 using System.Collections.Generic; 3 3 using System.Linq; 4 using System.Reflection; 4 5 using HEAL.Attic; 5 6 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 16 17 var dict = new Dictionary<Guid, string>(); 17 18 var duplicates = new Dictionary<string, string>(); 18 // using AppDomain instead of ApplicationManager so that NonDiscoverableTypes are also checked19 foreach (Type type in AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes())) {20 var attr = StorableTypeAttribute.GetStorableTypeAttribute(type);21 if (attr == null)22 continue;23 19 24 foreach (var guid in attr.Guids) { 25 if (!dict.ContainsKey(guid)) { 26 dict.Add(guid, type.FullName); 27 } else { 28 duplicates.Add(type.FullName, dict[guid]); 20 try { 21 // using AppDomain instead of ApplicationManager so that NonDiscoverableTypes are also checked 22 foreach (Type type in AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes())) { 23 var attr = StorableTypeAttribute.GetStorableTypeAttribute(type); 24 if (attr == null) 25 continue; 26 27 foreach (var guid in attr.Guids) { 28 if (!dict.ContainsKey(guid)) { 29 dict.Add(guid, type.FullName); 30 } else { 31 duplicates.Add(type.FullName, dict[guid]); 32 } 29 33 } 30 34 } 35 } catch (ReflectionTypeLoadException e) { 36 var loaderExeptions = string.Join("-----" + Environment.NewLine, e.LoaderExceptions.Select(x => x.ToString())); 37 var message = string.Join(Environment.NewLine, "Could not load all types. Check if test process architecture is set to x64.", 38 string.Empty, "Exception:", e, string.Empty, "LoaderExceptions:", loaderExeptions); 39 Assert.Fail(message); 31 40 } 32 41
Note: See TracChangeset
for help on using the changeset viewer.