Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/17/19 15:41:46 (5 years ago)
Author:
abeham
Message:

#2521: Worked on PTSP refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/StorableTest.cs

    r17226 r17260  
    2727using HEAL.Attic;
    2828using HeuristicLab.Common;
     29using HeuristicLab.MainForm;
    2930using HeuristicLab.PluginInfrastructure;
    3031using Microsoft.VisualStudio.TestTools.UnitTesting;
     
    9495      Assert.IsTrue(errorMessage.Length == 0, errorMessage.ToString());
    9596    }
     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    }
    96128  }
    97129}
Note: See TracChangeset for help on using the changeset viewer.