Changeset 16467
- Timestamp:
- 12/29/18 20:41:52 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2520_PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Persistence.Fossil/UseCases.cs
r16466 r16467 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Drawing; 24 25 using System.IO; 26 using System.Linq; 27 using System.Reflection; 25 28 using System.Threading.Tasks; 26 29 using HEAL.Fossil; 27 30 using HeuristicLab.Algorithms.GeneticAlgorithm; 31 using HeuristicLab.Common; 28 32 using HeuristicLab.Persistence.Core; 33 using HeuristicLab.Persistence.Default.Xml; 29 34 using Microsoft.VisualStudio.TestTools.UnitTesting; 30 35 … … 124 129 } 125 130 131 132 [TestMethod] 133 [TestCategory("Persistence.Fossil")] 134 [TestProperty("Time", "short")] 135 public void TestLoadingSamples() { 136 var path = @"C:\reps\hl-core\branches\2520_PersistenceReintegration\HeuristicLab.Optimizer\3.3\Documents"; 137 var serializer = new ProtoBufSerializer(); 138 foreach (var fileName in Directory.EnumerateFiles(path, "*.hl")) { 139 var original = XmlParser.Deserialize(fileName); 140 var ok = true; 141 foreach (var t in original.GetObjectGraphObjects().Select(o => o.GetType())) { 142 if ( 143 t.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public) 144 .Any(ctor => StorableConstructorAttribute.IsStorableConstructor(ctor))) { 145 try { 146 if (t.IsGenericType) { 147 var g = Mapper.StaticCache.GetGuid(t.GetGenericTypeDefinition()); 148 } else { 149 var g = Mapper.StaticCache.GetGuid(t); 150 } 151 } catch (Exception e) { 152 Console.WriteLine(t.FullName); 153 ok = false; 154 } 155 } 156 } 157 if (ok) { 158 serializer.Serialize(original, fileName + ".proto"); 159 var newVersion = serializer.Deserialize(fileName + ".proto"); 160 Console.WriteLine("File: " + fileName); 161 } 162 } 163 } 164 126 165 [ClassInitialize] 127 166 public static void Initialize(TestContext testContext) {
Note: See TracChangeset
for help on using the changeset viewer.