Changeset 17260 for branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/StorableTest.cs
- Timestamp:
- 09/17/19 15:41:46 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/StorableTest.cs
r17226 r17260 27 27 using HEAL.Attic; 28 28 using HeuristicLab.Common; 29 using HeuristicLab.MainForm; 29 30 using HeuristicLab.PluginInfrastructure; 30 31 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 94 95 Assert.IsTrue(errorMessage.Length == 0, errorMessage.ToString()); 95 96 } 97 98 [TestMethod] 99 [TestCategory("General")] 100 [TestCategory("Essential")] 101 [TestProperty("Time", "short")] 102 public void TestStorableTypeAttributePresence() { 103 var errorMessage = new StringBuilder(); 104 foreach (Assembly ass in AppDomain.CurrentDomain.GetAssemblies().Where(x => x.GetName().Name.StartsWith("HeuristicLab"))) { 105 if (ass == Assembly.GetExecutingAssembly()) continue; 106 foreach (Type t in ass.GetExportedTypes()) { 107 if (t.IsAbstract && t.IsSealed) continue; // static classes are abstract and sealed at IL level 108 if (t.Namespace != null && (t.Namespace.EndsWith(".Views") 109 || t.Namespace.StartsWith("ICSharpCode") 110 || t.Namespace.StartsWith("HeuristicLab.Problems.Instances") 111 || t.Namespace.StartsWith("HeuristicLab.PluginInfrastructure") 112 || t.Namespace.StartsWith("HeuristicLab.Persistence") 113 || t.Namespace.StartsWith("HeuristicLab.MainForm") 114 || t.Namespace.StartsWith("HeuristicLab.Clients") 115 || t.Namespace.StartsWith("HeuristicLab.CodeEditor"))) 116 continue; 117 if (typeof(IPlugin).IsAssignableFrom(t) || typeof(Attribute).IsAssignableFrom(t) || typeof(Exception).IsAssignableFrom(t) 118 || typeof(EventArgs).IsAssignableFrom(t) 119 || typeof(IView).IsAssignableFrom(t) || typeof(System.Windows.Forms.Control).IsAssignableFrom(t)) continue; 120 var attr = StorableTypeAttribute.GetStorableTypeAttribute(t); 121 if (attr == null) { 122 errorMessage.AppendLine(t.FullName + ": Does not contain a storable type attribute."); 123 } 124 } 125 } 126 Assert.IsTrue(errorMessage.Length == 0, errorMessage.ToString()); 127 } 96 128 } 97 129 }
Note: See TracChangeset
for help on using the changeset viewer.