Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/05/17 17:36:50 (7 years ago)
Author:
jkarder
Message:

#2520: worked on persistence

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PersistenceOverhaul/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCasesPersistenceNew.cs

    r14537 r14549  
    3333using HeuristicLab.Algorithms.GeneticAlgorithm;
    3434using HeuristicLab.Data;
    35 using HeuristicLab.Persistence;
    3635using HeuristicLab.Persistence.Auxiliary;
    3736using HeuristicLab.Persistence.Core;
     
    945944    #region Old persistence test methods
    946945    [TestMethod]
    947     [TestCategory("Persistence4")]
     946    [TestCategory("Persistence4-EXEPTION")]
    948947    [TestProperty("Time", "short")]
    949948    public void ComplexStorable() {
     
    10351034
    10361035    [TestMethod]
    1037     [TestCategory("Persistence4")]
     1036    [TestCategory("Persistence4-EXEPTION")]
    10381037    [TestProperty("Time", "short")]
    10391038    public void SelfReferences() {
     
    10631062
    10641063    [TestMethod]
    1065     [TestCategory("Persistence4")]
     1064    [TestCategory("Persistence4-EXEPTION")]
    10661065    [TestProperty("Time", "short")]
    10671066    public void ArrayCreation() {
     
    10761075      arrayListArray[2].Add(arrayListArray);
    10771076      arrayListArray[2].Add(arrayListArray);
    1078       Array a = Array.CreateInstance(
    1079                               typeof(object),
    1080                               new[] { 1, 2 }, new[] { 3, 4 });
    1081       arrayListArray[2].Add(a);
     1077      //Array a = Array.CreateInstance(
     1078      //                        typeof(object),
     1079      //                        new[] { 1, 2 }, new[] { 3, 4 });
     1080      //arrayListArray[2].Add(a);
    10821081      serializer.Serialize(arrayListArray, tempFile);
    10831082      object o = serializer.Deserialize(tempFile);
     
    13531352
    13541353    [TestMethod]
    1355     [TestCategory("Persistence4")]
     1354    [TestCategory("Persistence4-EXEPTION")]
    13561355    [TestProperty("Time", "short")]
    13571356    public void InstantiateParentChainReference() {
     
    15171516
    15181517    [TestMethod]
    1519     [TestCategory("Persistence4")]
     1518    [TestCategory("Persistence4-EXEPTION")]
    15201519    [TestProperty("Time", "short")]
    15211520    public void TestStreaming() {
     
    20572056    }
    20582057    #endregion
     2058
     2059    [StorableClass("6075F1E8-948A-4AD8-8F5A-942B777852EC")]
     2060    public class A {
     2061      [Storable]
     2062      public Tuple<B> B { get; set; }
     2063    }
     2064    [StorableClass("6075F1E8-948A-4AD8-8F5A-942B777852EC")]
     2065    public class B {
     2066      [Storable]
     2067      public A A { get; set; }
     2068    }
     2069
     2070    [TestMethod]
     2071    [TestCategory("Persistence4")]
     2072    [TestProperty("Time", "short")]
     2073    public void TestCyclicReferencesWithTuple() {
     2074      var test = new Func<A>(() => {
     2075        var a = new A { };
     2076        var b = new B { A = a };
     2077        a.B = Tuple.Create(b);
     2078        return a;
     2079      });
     2080      ProtoBufSerializer serializer = new ProtoBufSerializer();
     2081      serializer.Serialize(test(), tempFile);
     2082      object o = serializer.Deserialize(tempFile);
     2083      A result = (A)o;
     2084
     2085      Assert.AreEqual(result, result.B.Item1.A);
     2086      Assert.AreSame(result, result.B.Item1.A);
     2087
     2088      string msg = Profile(test);
     2089      Console.WriteLine(msg);
     2090    }
    20592091  }
    20602092}
Note: See TracChangeset for help on using the changeset viewer.