Changeset 14928


Ignore:
Timestamp:
05/04/17 18:16:25 (23 months ago)
Author:
gkronber
Message:

#2520 added unit tests and fixed all test cases for old persistence

Location:
branches/PersistenceReintegration
Files:
23 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/PersistenceReintegration/HeuristicLab.Common/3.3/Content/IContent.cs

    r14185 r14928  
    1919 */
    2020#endregion
     21using HeuristicLab.Persistence;
    2122
    2223namespace HeuristicLab.Common {
     24  [StorableType("b3934dc1-07c6-4ad2-aef0-c6ba1d0d4fc0")]
    2325  public interface IContent { }
    2426}
  • branches/PersistenceReintegration/HeuristicLab.Common/3.3/Content/IStorableContent.cs

    r14185 r14928  
    2020#endregion
    2121
     22using HeuristicLab.Persistence;
    2223
    2324namespace HeuristicLab.Common {
     25  [StorableType("1A137301-E2FA-4929-B78A-A15F697FD0A6")]
    2426  public interface IStorableContent : IContent {
    2527    string Filename { get; set; }
  • branches/PersistenceReintegration/HeuristicLab.Common/3.3/HeuristicLab.Common-3.3.csproj

    r12292 r14928  
    154154  </ItemGroup>
    155155  <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>
    156160    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
    157161      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
  • branches/PersistenceReintegration/HeuristicLab.Common/3.3/IDeepCloneable.cs

    r14185 r14928  
    2121
    2222using System;
     23using HeuristicLab.Persistence;
    2324
    2425namespace HeuristicLab.Common {
     26  [StorableType("1a5032e6-d98b-4afb-b49d-22fbe9eae7d0")]
    2527  public interface IDeepCloneable : ICloneable {
    2628    /// <summary>
  • branches/PersistenceReintegration/HeuristicLab.Core/3.3/Interfaces/IInstrumentedOperator.cs

    r14185 r14928  
    2424using System.Collections;
    2525using System.Collections.Generic;
     26using HeuristicLab.Persistence;
    2627
    2728namespace HeuristicLab.Core {
     29  [StorableType("182897d9-8e1f-485b-9bf6-bfca79544517")]
    2830  public interface IInstrumentedOperator : IOperator {
    2931    IEnumerable<IOperator> BeforeExecutionOperators { get; }
  • branches/PersistenceReintegration/HeuristicLab.Core/3.3/Interfaces/IItem.cs

    r14185 r14928  
    2323using System.Drawing;
    2424using HeuristicLab.Common;
     25using HeuristicLab.Persistence;
    2526
    2627namespace HeuristicLab.Core {
     
    2829  /// Interface to represent (almost) every HeuristicLab object (an object, an operator,...).
    2930  /// </summary>
     31  [StorableType("a4d8f5f3-a143-4831-b9d9-cd7d87a5ad9b")]
    3032  public interface IItem : IContent, IDeepCloneable {
    3133    string ItemName { get; }
  • branches/PersistenceReintegration/HeuristicLab.Core/3.3/Interfaces/INamedItem.cs

    r14185 r14928  
    2222using System;
    2323using HeuristicLab.Common;
     24using HeuristicLab.Persistence;
    2425
    2526namespace HeuristicLab.Core {
     27  [StorableType("5f707f4a-ecbe-4bba-8b45-d447ca0d4489")]
    2628  public interface INamedItem : IItem {
    2729    string Name { get; set; }
  • branches/PersistenceReintegration/HeuristicLab.Core/3.3/Interfaces/IOperator.cs

    r14185 r14928  
    2222using System;
    2323using System.Threading;
     24using HeuristicLab.Persistence;
    2425
    2526namespace HeuristicLab.Core {
     
    2728  /// Interface to represent an operator.
    2829  /// </summary>
     30  [StorableType("728ca387-3177-4d5a-9674-57740652d9d6")]
    2931  public interface IOperator : IParameterizedNamedItem {
    3032    bool Breakpoint { get; set; }
  • branches/PersistenceReintegration/HeuristicLab.Core/3.3/Interfaces/IParameterizedItem.cs

    r14185 r14928  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Persistence;
    2324
    2425namespace HeuristicLab.Core {
     
    2627  /// An interface which represents an item which contains parameters.
    2728  /// </summary>
     29  [StorableType("523e483f-233f-4ba7-bdf5-4d5c81814486")]
    2830  public interface IParameterizedItem : IItem {
    2931    IKeyedItemCollection<string, IParameter> Parameters { get; }
  • branches/PersistenceReintegration/HeuristicLab.Core/3.3/Interfaces/IParameterizedNamedItem.cs

    r14185 r14928  
     1using HeuristicLab.Persistence;
    12#region License Information
    23/* HeuristicLab
     
    2425  /// An interface which represents an item which has a name and contains parameters.
    2526  /// </summary>
     27  [StorableType("7c392153-41be-472b-b3f4-1f422052a47b")]
    2628  public interface IParameterizedNamedItem : INamedItem, IParameterizedItem { }
    2729}
  • branches/PersistenceReintegration/HeuristicLab.Operators/3.3/Operator.InstrumentedOperatorWrapper.cs

    r14927 r14928  
    3232
    3333namespace HeuristicLab.Operators {
     34  [StorableType("04de2f5a-b727-4044-a2ba-2507c7f34266")]
    3435  public abstract partial class Operator {
    3536    internal static IOperation CreateInstrumentedOperation(InstrumentedOperator instrumentedOperator) {
  • branches/PersistenceReintegration/HeuristicLab.Operators/3.3/Operator.cs

    r14927 r14928  
    3333  /// </summary>
    3434  [Item("Operator", "Base class for operators.")]
    35   [StorableClass]
    3635  public abstract partial class Operator : ParameterizedNamedItem, IOperator, IStatefulItem {
    3736    public static new Image StaticItemImage {
  • branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/Interfaces/IAlgorithm.cs

    r14185 r14928  
    2323using System.Collections.Generic;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Persistence;
    2526
    2627namespace HeuristicLab.Optimization {
     
    2829  /// Interface to represent an algorithm.
    2930  /// </summary>
     31  [StorableType("143a7a6e-e3de-4db2-89f1-c72ac0dd359d")]
    3032  public interface IAlgorithm : IParameterizedNamedItem, IOptimizer {
    3133    Type ProblemType { get; }
  • branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/Interfaces/ISelector.cs

    r14185 r14928  
    2222using HeuristicLab.Core;
    2323using HeuristicLab.Data;
     24using HeuristicLab.Persistence;
    2425
    2526namespace HeuristicLab.Optimization {
     
    2728  /// An interface which represents a selection operator.
    2829  /// </summary>
     30  [StorableType("fe2f1019-f779-4ad7-a5c0-f1fd513b614f")]
    2931  public interface ISelector : IOperator {
    3032    BoolValue CopySelected { get; set; }
  • branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/Interfaces/ISingleObjectiveOperator.cs

    r14185 r14928  
    1919 */
    2020#endregion
     21
     22 using HeuristicLab.Persistence;
    2123
    2224namespace HeuristicLab.Optimization {
     
    4951  /// </list>
    5052  /// </remarks>
     53  [StorableType("b3728350-b6c3-4e1a-a444-9aa72657808d")]
    5154  public interface ISingleObjectiveOperator { }
    5255}
  • branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/Interfaces/ISingleObjectiveSelector.cs

    r14185 r14928  
    2222using HeuristicLab.Core;
    2323using HeuristicLab.Data;
     24using HeuristicLab.Persistence;
    2425
    2526namespace HeuristicLab.Optimization {
     
    2728  /// An interface which represents a selection operator for selecting solutions of single-objective optimization problems.
    2829  /// </summary>
     30  [StorableType("d503517f-a92d-4124-a53d-cb3b6d7fe01f")]
    2931  public interface ISingleObjectiveSelector : ISelector, ISingleObjectiveOperator {
    3032    IValueLookupParameter<BoolValue> MaximizationParameter { get; }
  • branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/EnumSerializer.cs

    r14927 r14928  
    3636
    3737    public int Priority {
    38       get { return 100; }
     38      get { return 205; } // higher than storabletype
    3939    }
    4040
  • branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableReflection.cs

    r14185 r14928  
    4343        storableMembers.AddRange(GenerateStorableMembers(type.BaseType));
    4444
    45       var storableClassAttribute = GetStorableClassAttribute(type);
    46       if (storableClassAttribute != null) {
    47         switch (storableClassAttribute.Type) {
    48           case StorableClassType.MarkedOnly:
     45      var storableTypeAttribute = GetStorableTypeAttribute(type);
     46      if (storableTypeAttribute != null) {
     47        switch (storableTypeAttribute.MemberSelection) {
     48          case StorableMemberSelection.MarkedOnly:
    4949            AddMarkedMembers(type, storableMembers); break;
    50           case StorableClassType.AllFields:
     50          case StorableMemberSelection.AllFields:
    5151            AddAll(type, MemberTypes.Field, storableMembers); break;
    52           case StorableClassType.AllProperties:
     52          case StorableMemberSelection.AllProperties:
    5353            AddAll(type, MemberTypes.Property, storableMembers); break;
    54           case StorableClassType.AllFieldsAndAllProperties:
     54          case StorableMemberSelection.AllFieldsAndAllProperties:
    5555            AddAll(type, MemberTypes.Field | MemberTypes.Property, storableMembers); break;
    5656          default:
    57             throw new PersistenceException("unsupported [StorableClassType]: " + storableClassAttribute.Type);
     57            throw new PersistenceException("unsupported [StorableType]: " + storableTypeAttribute.MemberSelection);
    5858        }
    5959      }
     
    174174    #region [StorableClass] helpers
    175175
    176     private static StorableClassAttribute GetStorableClassAttribute(Type type) {
    177       lock (storableClassCache) {
    178         if (storableClassCache.ContainsKey(type))
    179           return storableClassCache[type];
    180         StorableClassAttribute attribute = type
    181           .GetCustomAttributes(typeof(StorableClassAttribute), false)
    182           .SingleOrDefault() as StorableClassAttribute;
    183         storableClassCache.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);
    184184        return attribute;
    185185      }
     
    187187
    188188    public static bool HasStorableClassAttribute(Type type) {
    189       return GetStorableClassAttribute(type) != null;
    190     }
    191 
    192     private static Dictionary<Type, StorableClassAttribute> storableClassCache =
    193       new Dictionary<Type, StorableClassAttribute>();
     189      return GetStorableTypeAttribute(type) != null;
     190    }
     191
     192    private static Dictionary<Type, StorableTypeAttribute> storableTypeCache =
     193      new Dictionary<Type, StorableTypeAttribute>();
    194194
    195195    #endregion
  • branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs

    r14927 r14928  
    3434  /// <summary>
    3535  /// Intended for serialization of all custom classes. Classes should have the
    36   /// <c>[StorableClass]</c> attribute set. The default mode is to serialize
     36  /// <c>[StorableType]</c> attribute set. The default mode is to serialize
    3737  /// members with the <c>[Storable]</c> attribute set. Alternatively the
    3838  /// storable mode can be set to <c>AllFields</c>, <c>AllProperties</c>
  • branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/StructSerializer.cs

    r14927 r14928  
    3737
    3838    public int Priority {
    39       get { return 50; }
     39      get { return 210; } // higher than storabletype
    4040    }
    4141
  • branches/PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/StorableAttributeTests.cs

    r14927 r14928  
    2424namespace HeuristicLab.Persistence.Tests {
    2525
    26   [StorableClass]
     26  [StorableType("8ee9edbf-2e34-46fc-8a61-7d2a5e24b04b")]
    2727  class DemoClass {
    2828
     
    3636  }
    3737
    38   [StorableClass]
     38  [StorableType("23f9f468-bbb3-4894-babc-a1a26ad2289c")]
    3939  class Base {
    4040    public string baseName;
     
    4646  }
    4747
    48   [StorableClass]
     48  [StorableType("a639cd7f-1bef-4899-9394-285d83dfbdbe")]
    4949  class Override : Base {
    5050    [Storable]
     
    5555  }
    5656
    57   [StorableClass]
     57  [StorableType("dd917278-d243-4c23-acc2-c6737f28e973")]
    5858  class Intermediate : Override {
    5959  }
    6060
    61   [StorableClass]
     61  [StorableType("7897d4a6-b848-4c1c-8656-d5004927f1ea")]
    6262  class New : Intermediate {
    6363    public string newName;
  • branches/PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCases.cs

    r14927 r14928  
    3636using HeuristicLab.Persistence.Core.Tokens;
    3737using HeuristicLab.Persistence.Default.CompositeSerializers;
    38 using HeuristicLab.Persistence;
    3938using HeuristicLab.Persistence.Default.DebugString;
    4039using HeuristicLab.Persistence.Default.Xml;
     
    4342using HeuristicLab.Tests;
    4443using Microsoft.VisualStudio.TestTools.UnitTesting;
     44using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    4545
    4646namespace HeuristicLab.Persistence.Tests {
    4747
    48   [StorableClass]
     48  [StorableType("8658966d-3731-4588-8a92-25740c677478")]
    4949  public class NumberTest {
    5050    [Storable]
     
    9595  }
    9696
    97   [StorableClass]
     97  [StorableType("30315bb1-3cac-498f-9ff4-b27f0f6234a8")]
    9898  public class NonDefaultConstructorClass {
    9999    [Storable]
     
    104104  }
    105105
    106   [StorableClass]
     106  [StorableType("42019826-a9f7-4e78-b035-19292cd34d26")]
    107107  public class IntWrapper {
    108108
     
    127127  }
    128128
    129   [StorableClass]
     129  [StorableType("92810c22-155c-4e61-a3ec-79533e5d3c1e")]
    130130  public class PrimitivesTest : NumberTest {
    131131    [Storable]
     
    157157  }
    158158
    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")]
    162163  public class RootBase {
    163164    [Storable]
     
    178179  }
    179180
    180   [StorableClass]
     181  [StorableType("26b42eae-7dbb-46bb-84b3-d50d357eec05")]
    181182  public class Root : RootBase {
    182183    [Storable]
     
    208209  }
    209210
     211  [StorableType("b976a474-cae4-4f08-b425-e69977e1e4bf")]
    210212  public enum SimpleEnum { one, two, three }
     213  [StorableType("4f41591b-e0be-42ae-af66-800c20d21356")]
    211214  public enum ComplexEnum { one = 1, two = 2, three = 3 }
    212215  [FlagsAttribute]
     216  [StorableType("426bb2f4-7951-4378-a923-bc7a8ce56bd7")]
    213217  public enum TrickyEnum { zero = 0, one = 1, two = 2 }
    214218
    215   [StorableClass]
     219  [StorableType("0fe878c9-35e6-4478-8cbe-438211b7a3a5")]
    216220  public class EnumTest {
    217221    [Storable]
     
    223227  }
    224228
    225   [StorableClass]
     229  [StorableType("b83a36e8-7ba7-4ce4-82c3-602678c2a7a5")]
    226230  public class Custom {
    227231    [Storable]
     
    233237  }
    234238
    235   [StorableClass]
     239  [StorableType("fe285830-9dc6-4b77-8f8b-3c09a02ef1e0")]
    236240  public class Manager {
    237241
     
    246250  }
    247251
    248   [StorableClass]
     252  [StorableType("49551a89-6586-4ce1-8323-a8fd4409a0f6")]
    249253  public class C {
    250254    [Storable]
     
    269273
    270274  [TestClass]
     275  [StorableType("adca4c31-c835-4113-83aa-26a7a2cb3204")]
    271276  public class UseCases {
    272277
     
    486491    }
    487492
    488     [StorableClass]
     493    [StorableType("f4af4d3d-7ae6-4da5-ab3c-5df3ca2daca7")]
    489494    public class NestedType {
    490495      [Storable]
     
    589594        new Configuration(new XmlFormat(),
    590595          new List<IPrimitiveSerializer> { new String2XmlSerializer() },
    591           new List<ICompositeSerializer> { 
     596          new List<ICompositeSerializer> {
    592597            new StorableSerializer(),
    593598            new Number2StringSerializer() }));
     
    690695      l.Add(new NonSerializable());
    691696      try {
    692         Serializer s = new Serializer(l,
     697        var s = new HeuristicLab.Persistence.Core.Serializer(l,
    693698          ConfigurationService.Instance.GetConfiguration(new XmlFormat()),
    694699          "ROOT", true);
     
    708713    public void TestAssemblyVersionCheck() {
    709714      IntWrapper i = new IntWrapper(1);
    710       Serializer s = new Serializer(i, ConfigurationService.Instance.GetDefaultConfig(new XmlFormat()));
     715      var s = new HeuristicLab.Persistence.Core.Serializer(i, ConfigurationService.Instance.GetDefaultConfig(new XmlFormat()));
    711716      XmlGenerator g = new XmlGenerator();
    712717      StringBuilder dataString = new StringBuilder();
     
    753758    }
    754759
    755     [StorableClass]
     760    [StorableType("121169c6-b68a-491b-93e7-9925d508c0f3")]
    756761    class Child {
    757762      [Storable]
     
    759764    }
    760765
    761     [StorableClass]
     766    [StorableType("58a160dd-1851-4f78-b585-cdd05d4213f2")]
    762767    class Parent {
    763768      [Storable]
     
    765770    }
    766771
    767     [StorableClass]
     772    [StorableType("f99dbc0d-6f4c-4165-8d94-fb749f8cee33")]
    768773    class GrandParent {
    769774      [Storable]
     
    785790    }
    786791
     792    [StorableType("d4898d57-d578-4136-86f6-c8f615dbb4ab")]
    787793    struct TestStruct {
    788794      int value;
     
    843849    }
    844850
    845     [StorableClass]
     851    [StorableType("2a354c02-5268-41d1-b80f-c68f1d9c2337")]
    846852    private class PersistenceHooks {
    847853      [Storable]
     
    880886    }
    881887
    882     [StorableClass]
     888    [StorableType("fd155497-a299-413e-a251-220f9d21c92e")]
    883889    private class CustomConstructor {
    884890      public string Value = "none";
     
    904910    }
    905911
    906     [StorableClass]
     912    [StorableType("f6cbcbdd-a3a1-4a87-b2e4-413f0255b12a")]
    907913    public class ExplodingDefaultConstructor {
    908914      public ExplodingDefaultConstructor() {
     
    954960    }
    955961
    956     [StorableClass]
     962    [StorableType("7333a419-f549-4f88-a761-a1197cf90bce")]
    957963    public class HookInheritanceTestBase {
    958964      [Storable]
     
    965971    }
    966972
    967     [StorableClass]
     973    [StorableType("d05112d0-57db-43fc-86b2-a4da9d6cb84b")]
    968974    public class HookInheritanceTestDerivedClass : HookInheritanceTestBase {
    969975      [Storable]
     
    987993    }
    988994
    989     [StorableClass(StorableClassType.AllFields)]
     995    [StorableType(StorableMemberSelection.AllFields, "6f92b947-032a-4455-81e6-116bf4c31f92")]
    990996    public class AllFieldsStorable {
    991997      public int Value1 = 1;
     
    10181024    }
    10191025
    1020     [StorableClass(StorableClassType.AllProperties)]
     1026    [StorableType(StorableMemberSelection.AllProperties, "9e5eff24-617e-44bc-ae0f-258bfd804247")]
    10211027    public class AllPropertiesStorable {
    10221028      public int Value1 = 1;
     
    10501056    }
    10511057
    1052     [StorableClass(StorableClassType.AllFieldsAndAllProperties)]
     1058    [StorableType(StorableMemberSelection.AllFieldsAndAllProperties, "b6e3468d-5aaf-47d9-bd87-6931b2c705cd")]
    10531059    public class AllFieldsAndAllPropertiesStorable {
    10541060      public int Value1 = 1;
     
    10811087    }
    10821088
    1083     [StorableClass(StorableClassType.MarkedOnly)]
     1089    [StorableType(StorableMemberSelection.MarkedOnly, "1730eaa1-0507-4e08-94d8-64e213f3401d")]
    10841090    public class MarkedOnlyStorable {
    10851091      public int Value1 = 1;
     
    11781184      }
    11791185    }
     1186    [StorableType("57867b53-fafd-4c4f-aa15-dcfd87fbffe7")]
    11801187    private class IdentityComparer<T> : IEqualityComparer<T> {
    11811188
     
    12411248    }
    12421249
    1243     [StorableClass]
     1250    [StorableType("aa595fbc-7359-49ad-a274-204ff3c97bb4")]
    12441251    public class ReadOnlyFail {
    12451252      [Storable]
     
    12631270
    12641271
    1265     [StorableClass]
     1272    [StorableType("34008801-bb73-4810-ad1a-de9921b49a5d")]
    12661273    public class WriteOnlyFail {
    12671274      [Storable]
     
    12841291    }
    12851292
    1286     [StorableClass]
     1293    [StorableType("38575b53-c706-4d20-a255-c567c21c99a4")]
    12871294    public class OneWayTest {
    12881295      public OneWayTest() { this.value = "default"; }
     
    13031310    public void TestOneWaySerialization() {
    13041311      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()));
    13061313      var it = serializer.GetEnumerator();
    13071314      it.MoveNext();
     
    13091316      Assert.AreEqual("ReadOnly", ((PrimitiveToken)it.Current).Name); it.MoveNext();
    13101317      Assert.AreEqual("ROOT", ((EndToken)it.Current).Name); it.MoveNext();
    1311       var deserializer = new Deserializer(new[] { 
     1318      var deserializer = new Deserializer(new[] {
    13121319        new TypeMapping(0, typeof(OneWayTest).AssemblyQualifiedName, typeof(StorableSerializer).AssemblyQualifiedName),
    13131320        new TypeMapping(1, typeof(string).AssemblyQualifiedName, typeof(String2XmlSerializer).AssemblyQualifiedName) });
     
    14111418    }
    14121419
     1420    [StorableType("07c965fc-8bd3-4baf-967c-374e1e9d9b31")]
    14131421    public class G<T, T2> {
     1422      [StorableType("f9b10931-841f-4e93-b5d7-3d025a9bf998")]
    14141423      public class S { }
     1424      [StorableType("a9414e79-427a-4dd2-a231-832314c834e3")]
    14151425      public class S2<T3, T4> { }
    14161426    }
     
    14611471      b[2] = byte.MaxValue;
    14621472      XmlGenerator.Serialize(b, tempFile);
    1463       var newB = (byte[]) XmlParser.Deserialize(tempFile);
     1473      var newB = (byte[])XmlParser.Deserialize(tempFile);
    14641474      CollectionAssert.AreEqual(b, newB);
    14651475    }
     
    14691479    [TestProperty("Time", "short")]
    14701480    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 };
    14721482      XmlGenerator.Serialize(values, tempFile);
    1473       var newValues = (List<double?>) XmlParser.Deserialize(tempFile);
     1483      var newValues = (List<double?>)XmlParser.Deserialize(tempFile);
    14741484      CollectionAssert.AreEqual(values, newValues);
    14751485    }
     
    14821492        DateTime.ParseExact("10.09.2014 12:21", "dd.MM.yyyy hh:mm", CultureInfo.InvariantCulture), DateTime.MaxValue};
    14831493      XmlGenerator.Serialize(values, tempFile);
    1484       var newValues = (List<DateTime?>) XmlParser.Deserialize(tempFile);
     1494      var newValues = (List<DateTime?>)XmlParser.Deserialize(tempFile);
    14851495      CollectionAssert.AreEqual(values, newValues);
    14861496    }
     
    14901500    [TestProperty("Time", "short")]
    14911501    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" };
    14931503      XmlGenerator.Serialize(values, tempFile);
    1494       var newValues = (List<String>) XmlParser.Deserialize(tempFile);
     1504      var newValues = (List<String>)XmlParser.Deserialize(tempFile);
    14951505      CollectionAssert.AreEqual(values, newValues);
    14961506    }
     
    15001510    [TestProperty("Time", "short")]
    15011511    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 });
    15031513      XmlGenerator.Serialize(s, tempFile);
    15041514      var newS = (char[])XmlParser.Deserialize(tempFile);
     
    15101520    [TestProperty("Time", "short")]
    15111521    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 });
    15131523      XmlGenerator.Serialize(s, tempFile);
    15141524      var newS = XmlParser.Deserialize(tempFile);
     
    15201530    [TestProperty("Time", "short")]
    15211531    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 });
    15231533      XmlGenerator.Serialize(q, tempFile);
    15241534      var newQ = (Queue<int>)XmlParser.Deserialize(tempFile);
  • branches/PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCasesPersistenceNew.cs

    r14921 r14928  
    166166  }
    167167
     168  [StorableType("c15e3ac3-2681-48a1-9171-d97321cd60bb")]
    168169  public enum TestEnum { va1, va2, va3, va8 };
    169170
     
    217218  }
    218219
     220  [StorableType("a6bd45c2-bf18-47d7-9f66-c130222f2f00")]
    219221  public enum SimpleEnum { one, two, three }
     222  [StorableType("b5c8285e-5c1b-457e-a5a3-e25eb588c283")]
    220223  public enum ComplexEnum { one = 1, two = 2, three = 3 }
    221224  [FlagsAttribute]
     225  [StorableType("c2ee7205-0a3a-443a-87d6-68568c4f4153")]
    222226  public enum TrickyEnum { zero = 0, one = 1, two = 2 }
    223227
     
    263267  }
    264268
     269  [StorableType("6494ee1d-877b-4e78-83df-f3f55a77b9b4")]
    265270  public class NonSerializable {
    266271    int x = 0;
     
    287292
    288293  [TestClass]
     294  [StorableType("6324d1f6-a82b-4914-937a-21846c4af9e6")]
    289295  public class UseCasesPersistenceNew {
    290296    #region Helpers
     
    311317
    312318    #region Persistence 4.0 Profiling Helpers 
     319    [StorableType("f90de8e3-e7d1-43b2-a8f0-6689ec922e87")]
    313320    public class PerformanceData {
    314321      public TimeSpan OldSerializingTime { get; set; }
     
    19641971    }
    19651972
     1973    [StorableType("4b4f6317-30c9-4ccd-ad5f-01775f728fbc")]
    19661974    public class G<T, T2> {
     1975      [StorableType("dad331ad-dfc5-4ea5-b044-3e582fcc648d")]
    19671976      public class S { }
     1977      [StorableType("171d3a18-d0ce-498a-a85f-7107a8a198ef")]
    19681978      public class S2<T3, T4> { }
    19691979    }
     
    22832293        p.a = 1;
    22842294        p.mySelf = p;
    2285         p.val = new int[] {2, 3, 4};
     2295        p.val = new int[] { 2, 3, 4 };
    22862296        p.TupItem1 = 17;
    22872297        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) };
    22892299        return p;
    22902300      });
     
    23402350    [TestProperty("Time", "short")]
    23412351    public void TestLoadingSamples() {
    2342       var path = @"D:\hl\branches\PersistenceOverhaul\HeuristicLab.Optimizer\3.3\Documents";
     2352      var path = @"D:\hl\branches\PersistenceReintegration\HeuristicLab.Optimizer\3.3\Documents";
    23432353      var serializer = new ProtoBufSerializer();
    23442354      foreach (var fileName in Directory.EnumerateFiles(path, "*.hl")) {
  • branches/PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Tests.csproj

    r14663 r14928  
    262262      <HintPath>..\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
    263263      <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>
    264268    </Reference>
    265269    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
     
    573577    <Compile Include="HeuristicLab.Persistence-3.3\StorableAttributeTests.cs" />
    574578    <Compile Include="HeuristicLab.Persistence-3.3\UseCases.cs" />
     579    <Compile Include="HeuristicLab.Persistence-3.3\UseCasesPersistenceNew.cs" />
    575580    <Compile Include="HeuristicLab.PluginInfraStructure-3.3\InstallationManagerTest.cs" />
    576581    <Compile Include="HeuristicLab.PluginInfraStructure-3.3\TypeExtensionsTest.cs" />
Note: See TracChangeset for help on using the changeset viewer.