Changeset 14928
- Timestamp:
- 05/04/17 18:16:25 (8 years ago)
- Location:
- branches/PersistenceReintegration
- Files:
-
- 23 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceReintegration/HeuristicLab.Common/3.3/Content/IContent.cs
r14185 r14928 19 19 */ 20 20 #endregion 21 using HeuristicLab.Persistence; 21 22 22 23 namespace HeuristicLab.Common { 24 [StorableType("b3934dc1-07c6-4ad2-aef0-c6ba1d0d4fc0")] 23 25 public interface IContent { } 24 26 } -
branches/PersistenceReintegration/HeuristicLab.Common/3.3/Content/IStorableContent.cs
r14185 r14928 20 20 #endregion 21 21 22 using HeuristicLab.Persistence; 22 23 23 24 namespace HeuristicLab.Common { 25 [StorableType("1A137301-E2FA-4929-B78A-A15F697FD0A6")] 24 26 public interface IStorableContent : IContent { 25 27 string Filename { get; set; } -
branches/PersistenceReintegration/HeuristicLab.Common/3.3/HeuristicLab.Common-3.3.csproj
r12292 r14928 154 154 </ItemGroup> 155 155 <ItemGroup> 156 <ProjectReference Include="..\..\HeuristicLab.Persistence\4.0\HeuristicLab.Persistence-4.0.csproj"> 157 <Project>{B1663091-8156-4DEB-9E37-5B19810A4644}</Project> 158 <Name>HeuristicLab.Persistence-4.0</Name> 159 </ProjectReference> 156 160 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj"> 157 161 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project> -
branches/PersistenceReintegration/HeuristicLab.Common/3.3/IDeepCloneable.cs
r14185 r14928 21 21 22 22 using System; 23 using HeuristicLab.Persistence; 23 24 24 25 namespace HeuristicLab.Common { 26 [StorableType("1a5032e6-d98b-4afb-b49d-22fbe9eae7d0")] 25 27 public interface IDeepCloneable : ICloneable { 26 28 /// <summary> -
branches/PersistenceReintegration/HeuristicLab.Core/3.3/Interfaces/IInstrumentedOperator.cs
r14185 r14928 24 24 using System.Collections; 25 25 using System.Collections.Generic; 26 using HeuristicLab.Persistence; 26 27 27 28 namespace HeuristicLab.Core { 29 [StorableType("182897d9-8e1f-485b-9bf6-bfca79544517")] 28 30 public interface IInstrumentedOperator : IOperator { 29 31 IEnumerable<IOperator> BeforeExecutionOperators { get; } -
branches/PersistenceReintegration/HeuristicLab.Core/3.3/Interfaces/IItem.cs
r14185 r14928 23 23 using System.Drawing; 24 24 using HeuristicLab.Common; 25 using HeuristicLab.Persistence; 25 26 26 27 namespace HeuristicLab.Core { … … 28 29 /// Interface to represent (almost) every HeuristicLab object (an object, an operator,...). 29 30 /// </summary> 31 [StorableType("a4d8f5f3-a143-4831-b9d9-cd7d87a5ad9b")] 30 32 public interface IItem : IContent, IDeepCloneable { 31 33 string ItemName { get; } -
branches/PersistenceReintegration/HeuristicLab.Core/3.3/Interfaces/INamedItem.cs
r14185 r14928 22 22 using System; 23 23 using HeuristicLab.Common; 24 using HeuristicLab.Persistence; 24 25 25 26 namespace HeuristicLab.Core { 27 [StorableType("5f707f4a-ecbe-4bba-8b45-d447ca0d4489")] 26 28 public interface INamedItem : IItem { 27 29 string Name { get; set; } -
branches/PersistenceReintegration/HeuristicLab.Core/3.3/Interfaces/IOperator.cs
r14185 r14928 22 22 using System; 23 23 using System.Threading; 24 using HeuristicLab.Persistence; 24 25 25 26 namespace HeuristicLab.Core { … … 27 28 /// Interface to represent an operator. 28 29 /// </summary> 30 [StorableType("728ca387-3177-4d5a-9674-57740652d9d6")] 29 31 public interface IOperator : IParameterizedNamedItem { 30 32 bool Breakpoint { get; set; } -
branches/PersistenceReintegration/HeuristicLab.Core/3.3/Interfaces/IParameterizedItem.cs
r14185 r14928 21 21 22 22 using System.Collections.Generic; 23 using HeuristicLab.Persistence; 23 24 24 25 namespace HeuristicLab.Core { … … 26 27 /// An interface which represents an item which contains parameters. 27 28 /// </summary> 29 [StorableType("523e483f-233f-4ba7-bdf5-4d5c81814486")] 28 30 public interface IParameterizedItem : IItem { 29 31 IKeyedItemCollection<string, IParameter> Parameters { get; } -
branches/PersistenceReintegration/HeuristicLab.Core/3.3/Interfaces/IParameterizedNamedItem.cs
r14185 r14928 1 using HeuristicLab.Persistence; 1 2 #region License Information 2 3 /* HeuristicLab … … 24 25 /// An interface which represents an item which has a name and contains parameters. 25 26 /// </summary> 27 [StorableType("7c392153-41be-472b-b3f4-1f422052a47b")] 26 28 public interface IParameterizedNamedItem : INamedItem, IParameterizedItem { } 27 29 } -
branches/PersistenceReintegration/HeuristicLab.Operators/3.3/Operator.InstrumentedOperatorWrapper.cs
r14927 r14928 32 32 33 33 namespace HeuristicLab.Operators { 34 [StorableType("04de2f5a-b727-4044-a2ba-2507c7f34266")] 34 35 public abstract partial class Operator { 35 36 internal static IOperation CreateInstrumentedOperation(InstrumentedOperator instrumentedOperator) { -
branches/PersistenceReintegration/HeuristicLab.Operators/3.3/Operator.cs
r14927 r14928 33 33 /// </summary> 34 34 [Item("Operator", "Base class for operators.")] 35 [StorableClass]36 35 public abstract partial class Operator : ParameterizedNamedItem, IOperator, IStatefulItem { 37 36 public static new Image StaticItemImage { -
branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/Interfaces/IAlgorithm.cs
r14185 r14928 23 23 using System.Collections.Generic; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Persistence; 25 26 26 27 namespace HeuristicLab.Optimization { … … 28 29 /// Interface to represent an algorithm. 29 30 /// </summary> 31 [StorableType("143a7a6e-e3de-4db2-89f1-c72ac0dd359d")] 30 32 public interface IAlgorithm : IParameterizedNamedItem, IOptimizer { 31 33 Type ProblemType { get; } -
branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/Interfaces/ISelector.cs
r14185 r14928 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Data; 24 using HeuristicLab.Persistence; 24 25 25 26 namespace HeuristicLab.Optimization { … … 27 28 /// An interface which represents a selection operator. 28 29 /// </summary> 30 [StorableType("fe2f1019-f779-4ad7-a5c0-f1fd513b614f")] 29 31 public interface ISelector : IOperator { 30 32 BoolValue CopySelected { get; set; } -
branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/Interfaces/ISingleObjectiveOperator.cs
r14185 r14928 19 19 */ 20 20 #endregion 21 22 using HeuristicLab.Persistence; 21 23 22 24 namespace HeuristicLab.Optimization { … … 49 51 /// </list> 50 52 /// </remarks> 53 [StorableType("b3728350-b6c3-4e1a-a444-9aa72657808d")] 51 54 public interface ISingleObjectiveOperator { } 52 55 } -
branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/Interfaces/ISingleObjectiveSelector.cs
r14185 r14928 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Data; 24 using HeuristicLab.Persistence; 24 25 25 26 namespace HeuristicLab.Optimization { … … 27 28 /// An interface which represents a selection operator for selecting solutions of single-objective optimization problems. 28 29 /// </summary> 30 [StorableType("d503517f-a92d-4124-a53d-cb3b6d7fe01f")] 29 31 public interface ISingleObjectiveSelector : ISelector, ISingleObjectiveOperator { 30 32 IValueLookupParameter<BoolValue> MaximizationParameter { get; } -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/EnumSerializer.cs
r14927 r14928 36 36 37 37 public int Priority { 38 get { return 100; }38 get { return 205; } // higher than storabletype 39 39 } 40 40 -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableReflection.cs
r14185 r14928 43 43 storableMembers.AddRange(GenerateStorableMembers(type.BaseType)); 44 44 45 var storable ClassAttribute = GetStorableClassAttribute(type);46 if (storable ClassAttribute != null) {47 switch (storable ClassAttribute.Type) {48 case Storable ClassType.MarkedOnly:45 var storableTypeAttribute = GetStorableTypeAttribute(type); 46 if (storableTypeAttribute != null) { 47 switch (storableTypeAttribute.MemberSelection) { 48 case StorableMemberSelection.MarkedOnly: 49 49 AddMarkedMembers(type, storableMembers); break; 50 case Storable ClassType.AllFields:50 case StorableMemberSelection.AllFields: 51 51 AddAll(type, MemberTypes.Field, storableMembers); break; 52 case Storable ClassType.AllProperties:52 case StorableMemberSelection.AllProperties: 53 53 AddAll(type, MemberTypes.Property, storableMembers); break; 54 case Storable ClassType.AllFieldsAndAllProperties:54 case StorableMemberSelection.AllFieldsAndAllProperties: 55 55 AddAll(type, MemberTypes.Field | MemberTypes.Property, storableMembers); break; 56 56 default: 57 throw new PersistenceException("unsupported [Storable ClassType]: " + storableClassAttribute.Type);57 throw new PersistenceException("unsupported [StorableType]: " + storableTypeAttribute.MemberSelection); 58 58 } 59 59 } … … 174 174 #region [StorableClass] helpers 175 175 176 private static Storable ClassAttribute GetStorableClassAttribute(Type type) {177 lock (storable ClassCache) {178 if (storable ClassCache.ContainsKey(type))179 return storable ClassCache[type];180 Storable ClassAttribute attribute = type181 .GetCustomAttributes(typeof(Storable ClassAttribute), false)182 .SingleOrDefault() as Storable ClassAttribute;183 storable ClassCache.Add(type, attribute);176 private static StorableTypeAttribute GetStorableTypeAttribute(Type type) { 177 lock (storableTypeCache) { 178 if (storableTypeCache.ContainsKey(type)) 179 return storableTypeCache[type]; 180 StorableTypeAttribute attribute = type 181 .GetCustomAttributes(typeof(StorableTypeAttribute), false) 182 .SingleOrDefault() as StorableTypeAttribute; 183 storableTypeCache.Add(type, attribute); 184 184 return attribute; 185 185 } … … 187 187 188 188 public static bool HasStorableClassAttribute(Type type) { 189 return GetStorable ClassAttribute(type) != null;190 } 191 192 private static Dictionary<Type, Storable ClassAttribute> storableClassCache =193 new Dictionary<Type, Storable ClassAttribute>();189 return GetStorableTypeAttribute(type) != null; 190 } 191 192 private static Dictionary<Type, StorableTypeAttribute> storableTypeCache = 193 new Dictionary<Type, StorableTypeAttribute>(); 194 194 195 195 #endregion -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
r14927 r14928 34 34 /// <summary> 35 35 /// Intended for serialization of all custom classes. Classes should have the 36 /// <c>[Storable Class]</c> attribute set. The default mode is to serialize36 /// <c>[StorableType]</c> attribute set. The default mode is to serialize 37 37 /// members with the <c>[Storable]</c> attribute set. Alternatively the 38 38 /// storable mode can be set to <c>AllFields</c>, <c>AllProperties</c> -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/StructSerializer.cs
r14927 r14928 37 37 38 38 public int Priority { 39 get { return 50; }39 get { return 210; } // higher than storabletype 40 40 } 41 41 -
branches/PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/StorableAttributeTests.cs
r14927 r14928 24 24 namespace HeuristicLab.Persistence.Tests { 25 25 26 [Storable Class]26 [StorableType("8ee9edbf-2e34-46fc-8a61-7d2a5e24b04b")] 27 27 class DemoClass { 28 28 … … 36 36 } 37 37 38 [Storable Class]38 [StorableType("23f9f468-bbb3-4894-babc-a1a26ad2289c")] 39 39 class Base { 40 40 public string baseName; … … 46 46 } 47 47 48 [Storable Class]48 [StorableType("a639cd7f-1bef-4899-9394-285d83dfbdbe")] 49 49 class Override : Base { 50 50 [Storable] … … 55 55 } 56 56 57 [Storable Class]57 [StorableType("dd917278-d243-4c23-acc2-c6737f28e973")] 58 58 class Intermediate : Override { 59 59 } 60 60 61 [Storable Class]61 [StorableType("7897d4a6-b848-4c1c-8656-d5004927f1ea")] 62 62 class New : Intermediate { 63 63 public string newName; -
branches/PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCases.cs
r14927 r14928 36 36 using HeuristicLab.Persistence.Core.Tokens; 37 37 using HeuristicLab.Persistence.Default.CompositeSerializers; 38 using HeuristicLab.Persistence;39 38 using HeuristicLab.Persistence.Default.DebugString; 40 39 using HeuristicLab.Persistence.Default.Xml; … … 43 42 using HeuristicLab.Tests; 44 43 using Microsoft.VisualStudio.TestTools.UnitTesting; 44 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 45 45 46 46 namespace HeuristicLab.Persistence.Tests { 47 47 48 [Storable Class]48 [StorableType("8658966d-3731-4588-8a92-25740c677478")] 49 49 public class NumberTest { 50 50 [Storable] … … 95 95 } 96 96 97 [Storable Class]97 [StorableType("30315bb1-3cac-498f-9ff4-b27f0f6234a8")] 98 98 public class NonDefaultConstructorClass { 99 99 [Storable] … … 104 104 } 105 105 106 [Storable Class]106 [StorableType("42019826-a9f7-4e78-b035-19292cd34d26")] 107 107 public class IntWrapper { 108 108 … … 127 127 } 128 128 129 [Storable Class]129 [StorableType("92810c22-155c-4e61-a3ec-79533e5d3c1e")] 130 130 public class PrimitivesTest : NumberTest { 131 131 [Storable] … … 157 157 } 158 158 159 public enum TestEnum { va1, va2, va3, va8 } ; 160 161 [StorableClass] 159 [StorableType("09355759-308f-438d-95a1-63704159b833")] 160 public enum TestEnum { va1, va2, va3, va8 }; 161 162 [StorableType("92efaa22-6ae0-4004-a0a8-7bfe397d25d0")] 162 163 public class RootBase { 163 164 [Storable] … … 178 179 } 179 180 180 [Storable Class]181 [StorableType("26b42eae-7dbb-46bb-84b3-d50d357eec05")] 181 182 public class Root : RootBase { 182 183 [Storable] … … 208 209 } 209 210 211 [StorableType("b976a474-cae4-4f08-b425-e69977e1e4bf")] 210 212 public enum SimpleEnum { one, two, three } 213 [StorableType("4f41591b-e0be-42ae-af66-800c20d21356")] 211 214 public enum ComplexEnum { one = 1, two = 2, three = 3 } 212 215 [FlagsAttribute] 216 [StorableType("426bb2f4-7951-4378-a923-bc7a8ce56bd7")] 213 217 public enum TrickyEnum { zero = 0, one = 1, two = 2 } 214 218 215 [Storable Class]219 [StorableType("0fe878c9-35e6-4478-8cbe-438211b7a3a5")] 216 220 public class EnumTest { 217 221 [Storable] … … 223 227 } 224 228 225 [Storable Class]229 [StorableType("b83a36e8-7ba7-4ce4-82c3-602678c2a7a5")] 226 230 public class Custom { 227 231 [Storable] … … 233 237 } 234 238 235 [Storable Class]239 [StorableType("fe285830-9dc6-4b77-8f8b-3c09a02ef1e0")] 236 240 public class Manager { 237 241 … … 246 250 } 247 251 248 [Storable Class]252 [StorableType("49551a89-6586-4ce1-8323-a8fd4409a0f6")] 249 253 public class C { 250 254 [Storable] … … 269 273 270 274 [TestClass] 275 [StorableType("adca4c31-c835-4113-83aa-26a7a2cb3204")] 271 276 public class UseCases { 272 277 … … 486 491 } 487 492 488 [Storable Class]493 [StorableType("f4af4d3d-7ae6-4da5-ab3c-5df3ca2daca7")] 489 494 public class NestedType { 490 495 [Storable] … … 589 594 new Configuration(new XmlFormat(), 590 595 new List<IPrimitiveSerializer> { new String2XmlSerializer() }, 591 new List<ICompositeSerializer> { 596 new List<ICompositeSerializer> { 592 597 new StorableSerializer(), 593 598 new Number2StringSerializer() })); … … 690 695 l.Add(new NonSerializable()); 691 696 try { 692 Serializer s = newSerializer(l,697 var s = new HeuristicLab.Persistence.Core.Serializer(l, 693 698 ConfigurationService.Instance.GetConfiguration(new XmlFormat()), 694 699 "ROOT", true); … … 708 713 public void TestAssemblyVersionCheck() { 709 714 IntWrapper i = new IntWrapper(1); 710 Serializer s = newSerializer(i, ConfigurationService.Instance.GetDefaultConfig(new XmlFormat()));715 var s = new HeuristicLab.Persistence.Core.Serializer(i, ConfigurationService.Instance.GetDefaultConfig(new XmlFormat())); 711 716 XmlGenerator g = new XmlGenerator(); 712 717 StringBuilder dataString = new StringBuilder(); … … 753 758 } 754 759 755 [Storable Class]760 [StorableType("121169c6-b68a-491b-93e7-9925d508c0f3")] 756 761 class Child { 757 762 [Storable] … … 759 764 } 760 765 761 [Storable Class]766 [StorableType("58a160dd-1851-4f78-b585-cdd05d4213f2")] 762 767 class Parent { 763 768 [Storable] … … 765 770 } 766 771 767 [Storable Class]772 [StorableType("f99dbc0d-6f4c-4165-8d94-fb749f8cee33")] 768 773 class GrandParent { 769 774 [Storable] … … 785 790 } 786 791 792 [StorableType("d4898d57-d578-4136-86f6-c8f615dbb4ab")] 787 793 struct TestStruct { 788 794 int value; … … 843 849 } 844 850 845 [Storable Class]851 [StorableType("2a354c02-5268-41d1-b80f-c68f1d9c2337")] 846 852 private class PersistenceHooks { 847 853 [Storable] … … 880 886 } 881 887 882 [Storable Class]888 [StorableType("fd155497-a299-413e-a251-220f9d21c92e")] 883 889 private class CustomConstructor { 884 890 public string Value = "none"; … … 904 910 } 905 911 906 [Storable Class]912 [StorableType("f6cbcbdd-a3a1-4a87-b2e4-413f0255b12a")] 907 913 public class ExplodingDefaultConstructor { 908 914 public ExplodingDefaultConstructor() { … … 954 960 } 955 961 956 [Storable Class]962 [StorableType("7333a419-f549-4f88-a761-a1197cf90bce")] 957 963 public class HookInheritanceTestBase { 958 964 [Storable] … … 965 971 } 966 972 967 [Storable Class]973 [StorableType("d05112d0-57db-43fc-86b2-a4da9d6cb84b")] 968 974 public class HookInheritanceTestDerivedClass : HookInheritanceTestBase { 969 975 [Storable] … … 987 993 } 988 994 989 [Storable Class(StorableClassType.AllFields)]995 [StorableType(StorableMemberSelection.AllFields, "6f92b947-032a-4455-81e6-116bf4c31f92")] 990 996 public class AllFieldsStorable { 991 997 public int Value1 = 1; … … 1018 1024 } 1019 1025 1020 [Storable Class(StorableClassType.AllProperties)]1026 [StorableType(StorableMemberSelection.AllProperties, "9e5eff24-617e-44bc-ae0f-258bfd804247")] 1021 1027 public class AllPropertiesStorable { 1022 1028 public int Value1 = 1; … … 1050 1056 } 1051 1057 1052 [Storable Class(StorableClassType.AllFieldsAndAllProperties)]1058 [StorableType(StorableMemberSelection.AllFieldsAndAllProperties, "b6e3468d-5aaf-47d9-bd87-6931b2c705cd")] 1053 1059 public class AllFieldsAndAllPropertiesStorable { 1054 1060 public int Value1 = 1; … … 1081 1087 } 1082 1088 1083 [Storable Class(StorableClassType.MarkedOnly)]1089 [StorableType(StorableMemberSelection.MarkedOnly, "1730eaa1-0507-4e08-94d8-64e213f3401d")] 1084 1090 public class MarkedOnlyStorable { 1085 1091 public int Value1 = 1; … … 1178 1184 } 1179 1185 } 1186 [StorableType("57867b53-fafd-4c4f-aa15-dcfd87fbffe7")] 1180 1187 private class IdentityComparer<T> : IEqualityComparer<T> { 1181 1188 … … 1241 1248 } 1242 1249 1243 [Storable Class]1250 [StorableType("aa595fbc-7359-49ad-a274-204ff3c97bb4")] 1244 1251 public class ReadOnlyFail { 1245 1252 [Storable] … … 1263 1270 1264 1271 1265 [Storable Class]1272 [StorableType("34008801-bb73-4810-ad1a-de9921b49a5d")] 1266 1273 public class WriteOnlyFail { 1267 1274 [Storable] … … 1284 1291 } 1285 1292 1286 [Storable Class]1293 [StorableType("38575b53-c706-4d20-a255-c567c21c99a4")] 1287 1294 public class OneWayTest { 1288 1295 public OneWayTest() { this.value = "default"; } … … 1303 1310 public void TestOneWaySerialization() { 1304 1311 var test = new OneWayTest(); 1305 var serializer = new Serializer(test, ConfigurationService.Instance.GetDefaultConfig(new XmlFormat()));1312 var serializer = new HeuristicLab.Persistence.Core.Serializer(test, ConfigurationService.Instance.GetDefaultConfig(new XmlFormat())); 1306 1313 var it = serializer.GetEnumerator(); 1307 1314 it.MoveNext(); … … 1309 1316 Assert.AreEqual("ReadOnly", ((PrimitiveToken)it.Current).Name); it.MoveNext(); 1310 1317 Assert.AreEqual("ROOT", ((EndToken)it.Current).Name); it.MoveNext(); 1311 var deserializer = new Deserializer(new[] { 1318 var deserializer = new Deserializer(new[] { 1312 1319 new TypeMapping(0, typeof(OneWayTest).AssemblyQualifiedName, typeof(StorableSerializer).AssemblyQualifiedName), 1313 1320 new TypeMapping(1, typeof(string).AssemblyQualifiedName, typeof(String2XmlSerializer).AssemblyQualifiedName) }); … … 1411 1418 } 1412 1419 1420 [StorableType("07c965fc-8bd3-4baf-967c-374e1e9d9b31")] 1413 1421 public class G<T, T2> { 1422 [StorableType("f9b10931-841f-4e93-b5d7-3d025a9bf998")] 1414 1423 public class S { } 1424 [StorableType("a9414e79-427a-4dd2-a231-832314c834e3")] 1415 1425 public class S2<T3, T4> { } 1416 1426 } … … 1461 1471 b[2] = byte.MaxValue; 1462 1472 XmlGenerator.Serialize(b, tempFile); 1463 var newB = (byte[]) 1473 var newB = (byte[])XmlParser.Deserialize(tempFile); 1464 1474 CollectionAssert.AreEqual(b, newB); 1465 1475 } … … 1469 1479 [TestProperty("Time", "short")] 1470 1480 public void TestOptionalNumberEnumerable() { 1471 var values = new List<double?> { 0, null, double.NaN, double.PositiveInfinity, double.MaxValue, 1};1481 var values = new List<double?> { 0, null, double.NaN, double.PositiveInfinity, double.MaxValue, 1 }; 1472 1482 XmlGenerator.Serialize(values, tempFile); 1473 var newValues = (List<double?>) 1483 var newValues = (List<double?>)XmlParser.Deserialize(tempFile); 1474 1484 CollectionAssert.AreEqual(values, newValues); 1475 1485 } … … 1482 1492 DateTime.ParseExact("10.09.2014 12:21", "dd.MM.yyyy hh:mm", CultureInfo.InvariantCulture), DateTime.MaxValue}; 1483 1493 XmlGenerator.Serialize(values, tempFile); 1484 var newValues = (List<DateTime?>) 1494 var newValues = (List<DateTime?>)XmlParser.Deserialize(tempFile); 1485 1495 CollectionAssert.AreEqual(values, newValues); 1486 1496 } … … 1490 1500 [TestProperty("Time", "short")] 1491 1501 public void TestStringEnumerable() { 1492 var values = new List<string> { "", null, "s", "string", string.Empty, "123", "<![CDATA[nice]]>", "<![CDATA[nasty unterminated"};1502 var values = new List<string> { "", null, "s", "string", string.Empty, "123", "<![CDATA[nice]]>", "<![CDATA[nasty unterminated" }; 1493 1503 XmlGenerator.Serialize(values, tempFile); 1494 var newValues = (List<String>) 1504 var newValues = (List<String>)XmlParser.Deserialize(tempFile); 1495 1505 CollectionAssert.AreEqual(values, newValues); 1496 1506 } … … 1500 1510 [TestProperty("Time", "short")] 1501 1511 public void TestUnicodeCharArray() { 1502 var s = Encoding.UTF8.GetChars(new byte[] { 0, 1, 2, 03, 04, 05, 06, 07, 08, 09, 0xa, 0xb});1512 var s = Encoding.UTF8.GetChars(new byte[] { 0, 1, 2, 03, 04, 05, 06, 07, 08, 09, 0xa, 0xb }); 1503 1513 XmlGenerator.Serialize(s, tempFile); 1504 1514 var newS = (char[])XmlParser.Deserialize(tempFile); … … 1510 1520 [TestProperty("Time", "short")] 1511 1521 public void TestUnicode() { 1512 var s = Encoding.UTF8.GetString(new byte[] { 0, 1, 2, 03, 04, 05, 06, 07, 08, 09, 0xa, 0xb});1522 var s = Encoding.UTF8.GetString(new byte[] { 0, 1, 2, 03, 04, 05, 06, 07, 08, 09, 0xa, 0xb }); 1513 1523 XmlGenerator.Serialize(s, tempFile); 1514 1524 var newS = XmlParser.Deserialize(tempFile); … … 1520 1530 [TestProperty("Time", "short")] 1521 1531 public void TestQueue() { 1522 var q = new Queue<int>(new[] { 1, 2, 3, 4, 0});1532 var q = new Queue<int>(new[] { 1, 2, 3, 4, 0 }); 1523 1533 XmlGenerator.Serialize(q, tempFile); 1524 1534 var newQ = (Queue<int>)XmlParser.Deserialize(tempFile); -
branches/PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCasesPersistenceNew.cs
r14921 r14928 166 166 } 167 167 168 [StorableType("c15e3ac3-2681-48a1-9171-d97321cd60bb")] 168 169 public enum TestEnum { va1, va2, va3, va8 }; 169 170 … … 217 218 } 218 219 220 [StorableType("a6bd45c2-bf18-47d7-9f66-c130222f2f00")] 219 221 public enum SimpleEnum { one, two, three } 222 [StorableType("b5c8285e-5c1b-457e-a5a3-e25eb588c283")] 220 223 public enum ComplexEnum { one = 1, two = 2, three = 3 } 221 224 [FlagsAttribute] 225 [StorableType("c2ee7205-0a3a-443a-87d6-68568c4f4153")] 222 226 public enum TrickyEnum { zero = 0, one = 1, two = 2 } 223 227 … … 263 267 } 264 268 269 [StorableType("6494ee1d-877b-4e78-83df-f3f55a77b9b4")] 265 270 public class NonSerializable { 266 271 int x = 0; … … 287 292 288 293 [TestClass] 294 [StorableType("6324d1f6-a82b-4914-937a-21846c4af9e6")] 289 295 public class UseCasesPersistenceNew { 290 296 #region Helpers … … 311 317 312 318 #region Persistence 4.0 Profiling Helpers 319 [StorableType("f90de8e3-e7d1-43b2-a8f0-6689ec922e87")] 313 320 public class PerformanceData { 314 321 public TimeSpan OldSerializingTime { get; set; } … … 1964 1971 } 1965 1972 1973 [StorableType("4b4f6317-30c9-4ccd-ad5f-01775f728fbc")] 1966 1974 public class G<T, T2> { 1975 [StorableType("dad331ad-dfc5-4ea5-b044-3e582fcc648d")] 1967 1976 public class S { } 1977 [StorableType("171d3a18-d0ce-498a-a85f-7107a8a198ef")] 1968 1978 public class S2<T3, T4> { } 1969 1979 } … … 2283 2293 p.a = 1; 2284 2294 p.mySelf = p; 2285 p.val = new int[] { 2, 3, 4};2295 p.val = new int[] { 2, 3, 4 }; 2286 2296 p.TupItem1 = 17; 2287 2297 p.TupItem2 = 4; 2288 p.items = new DoubleValue[] { new DoubleValue(1.0), new DoubleValue(2.0) };2298 p.items = new DoubleValue[] { new DoubleValue(1.0), new DoubleValue(2.0) }; 2289 2299 return p; 2290 2300 }); … … 2340 2350 [TestProperty("Time", "short")] 2341 2351 public void TestLoadingSamples() { 2342 var path = @"D:\hl\branches\Persistence Overhaul\HeuristicLab.Optimizer\3.3\Documents";2352 var path = @"D:\hl\branches\PersistenceReintegration\HeuristicLab.Optimizer\3.3\Documents"; 2343 2353 var serializer = new ProtoBufSerializer(); 2344 2354 foreach (var fileName in Directory.EnumerateFiles(path, "*.hl")) { -
branches/PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Tests.csproj
r14663 r14928 262 262 <HintPath>..\bin\HeuristicLab.Persistence-3.3.dll</HintPath> 263 263 <Private>False</Private> 264 </Reference> 265 <Reference Include="HeuristicLab.Persistence-4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 266 <SpecificVersion>False</SpecificVersion> 267 <HintPath>..\bin\HeuristicLab.Persistence-4.0.dll</HintPath> 264 268 </Reference> 265 269 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> … … 573 577 <Compile Include="HeuristicLab.Persistence-3.3\StorableAttributeTests.cs" /> 574 578 <Compile Include="HeuristicLab.Persistence-3.3\UseCases.cs" /> 579 <Compile Include="HeuristicLab.Persistence-3.3\UseCasesPersistenceNew.cs" /> 575 580 <Compile Include="HeuristicLab.PluginInfraStructure-3.3\InstallationManagerTest.cs" /> 576 581 <Compile Include="HeuristicLab.PluginInfraStructure-3.3\TypeExtensionsTest.cs" />
Note: See TracChangeset
for help on using the changeset viewer.