Ignore:
Timestamp:
11/26/15 17:07:28 (7 years ago)
Author:
ascheibe
Message:

#2520 worked on type and enum transformers

File:
1 edited

Legend:

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

    r13386 r13407  
    154154  }
    155155
    156   public enum TestEnum { va1, va2, va3, va8 } ;
     156  public enum TestEnum { va1, va2, va3, va8 };
    157157
    158158  [StorableClass("26BA37F6-926D-4665-A10A-1F39E1CF6468")]
     
    314314      Assert.AreEqual(test, result);
    315315    }
     316
     317    [TestMethod]
     318    [TestCategory("Persistence")]
     319    [TestProperty("Time", "short")]
     320    public void TestEnumSimple() {
     321      SimpleEnum se = SimpleEnum.two;
     322      ComplexEnum ce = ComplexEnum.three;
     323      ProtoBufSerializer serializer = new ProtoBufSerializer();
     324      serializer.Serialize(se, tempFile);
     325      object o = serializer.Deserialize(tempFile);
     326      SimpleEnum result = (SimpleEnum)o;
     327      Assert.AreEqual(se, result);
     328    }
     329
     330    [TestMethod]
     331    [TestCategory("Persistence")]
     332    [TestProperty("Time", "short")]
     333    public void TestEnumComplex() {
     334      ComplexEnum ce = ComplexEnum.three;
     335      ProtoBufSerializer serializer = new ProtoBufSerializer();
     336      serializer.Serialize(ce, tempFile);
     337      object o = serializer.Deserialize(tempFile);
     338      ComplexEnum result = (ComplexEnum)o;
     339      Assert.AreEqual(ce, result);
     340    }
     341
     342    [TestMethod]
     343    [TestCategory("Persistence")]
     344    [TestProperty("Time", "short")]
     345    public void TestType() {
     346      Type test = typeof(HeuristicLab.Algorithms.GeneticAlgorithm.GeneticAlgorithm);
     347      ProtoBufSerializer serializer = new ProtoBufSerializer();
     348      serializer.Serialize(test, tempFile);
     349      object o = serializer.Deserialize(tempFile);
     350      Type result = (Type)o;
     351      Assert.AreEqual(test, result);
     352    }
     353
    316354    #endregion
    317355
Note: See TracChangeset for help on using the changeset viewer.