Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/01/17 15:15:25 (7 years ago)
Author:
gkronber
Message:

#2520: fixed unit tests checking for exceptions

File:
1 edited

Legend:

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

    r15018 r15020  
    268268  }
    269269
    270   [StorableType("6494ee1d-877b-4e78-83df-f3f55a77b9b4")]
    271270  public class NonSerializable {
    272271    int x = 0;
     
    13821381      int value;
    13831382      int PropertyValue { get; set; }
     1383
     1384      /*
     1385      [StorableConstructor]
     1386      public TestStruct(StorableConstructorFlag deserializing) {
     1387        value = 0;
     1388        PropertyValue = 0;
     1389      }
     1390      */
     1391
    13841392      public TestStruct(int value)
    13851393        : this() {
     
    15841592      public int Value4 { get; private set; }
    15851593      [StorableConstructor]
    1586       public AllFieldsStorable(bool isDeserializing) {
    1587         if (!isDeserializing) {
    1588           Value1 = 12;
    1589           Value2 = 23;
    1590           Value3 = 34;
    1591           Value4 = 56;
    1592         }
     1594      public AllFieldsStorable(StorableConstructorFlag isdeserializing) {
     1595      }
     1596
     1597      public void InitValues() {
     1598        Value1 = 12;
     1599        Value2 = 23;
     1600        Value3 = 34;
     1601        Value4 = 56;
    15931602      }
    15941603    }
     
    15991608    public void TestStorableTypeDiscoveryAllFields() {
    16001609      ProtoBufSerializer serializer = new ProtoBufSerializer();
    1601       AllFieldsStorable afs = new AllFieldsStorable(false);
     1610      AllFieldsStorable afs = new AllFieldsStorable(default(StorableConstructorFlag));
     1611      afs.InitValues();
    16021612      serializer.Serialize(afs, tempFile);
    16031613      AllFieldsStorable newAfs = (AllFieldsStorable)serializer.Deserialize(tempFile);
     
    16151625      public int Value3 { get; private set; }
    16161626      public int Value4 { get; private set; }
    1617       [StorableConstructor]
    1618       public AllPropertiesStorable(bool isDeserializing) {
    1619         if (!isDeserializing) {
    1620           Value1 = 12;
    1621           Value2 = 23;
    1622           Value3 = 34;
    1623           Value4 = 56;
    1624         }
     1627
     1628      public AllPropertiesStorable() {
     1629      }
     1630
     1631      public void InitValues() {
     1632        Value1 = 12;
     1633        Value2 = 23;
     1634        Value3 = 34;
     1635        Value4 = 56;
    16251636      }
    16261637    }
     
    16311642    public void TestStorableTypeDiscoveryAllProperties() {
    16321643      ProtoBufSerializer serializer = new ProtoBufSerializer();
    1633       AllPropertiesStorable afs = new AllPropertiesStorable(false);
     1644      AllPropertiesStorable afs = new AllPropertiesStorable();
     1645      afs.InitValues();
    16341646      serializer.Serialize(afs, tempFile);
    16351647      AllPropertiesStorable newAfs = (AllPropertiesStorable)serializer.Deserialize(tempFile);
     
    16481660      public int Value3 { get; private set; }
    16491661      public int Value4 { get; private set; }
    1650       [StorableConstructor]
    1651       public AllFieldsAndAllPropertiesStorable(bool isDeserializing) {
    1652         if (!isDeserializing) {
    1653           Value1 = 12;
    1654           Value2 = 23;
    1655           Value3 = 34;
    1656           Value4 = 56;
    1657         }
     1662
     1663      public AllFieldsAndAllPropertiesStorable() {
     1664      }
     1665
     1666      public void InitValues() {
     1667        Value1 = 12;
     1668        Value2 = 23;
     1669        Value3 = 34;
     1670        Value4 = 56;
     1671
    16581672      }
    16591673    }
     
    16641678    public void TestStorableTypeDiscoveryAllFieldsAndAllProperties() {
    16651679      ProtoBufSerializer serializer = new ProtoBufSerializer();
    1666       AllFieldsAndAllPropertiesStorable afs = new AllFieldsAndAllPropertiesStorable(false);
     1680      AllFieldsAndAllPropertiesStorable afs = new AllFieldsAndAllPropertiesStorable();
     1681      afs.InitValues();
    16671682      serializer.Serialize(afs, tempFile);
    16681683      AllFieldsAndAllPropertiesStorable newAfs = (AllFieldsAndAllPropertiesStorable)serializer.Deserialize(tempFile);
     
    16801695      public int Value3 { get; private set; }
    16811696      public int Value4 { get; private set; }
    1682       [StorableConstructor]
    1683       public MarkedOnlyStorable(bool isDeserializing) {
    1684         if (!isDeserializing) {
    1685           Value1 = 12;
    1686           Value2 = 23;
    1687           Value3 = 34;
    1688           Value4 = 56;
    1689         }
     1697      public MarkedOnlyStorable() {
     1698      }
     1699
     1700      public void InitValues() {
     1701        Value1 = 12;
     1702        Value2 = 23;
     1703        Value3 = 34;
     1704        Value4 = 56;
    16901705      }
    16911706    }
     
    16961711    public void TestStorableTypeDiscoveryMarkedOnly() {
    16971712      ProtoBufSerializer serializer = new ProtoBufSerializer();
    1698       MarkedOnlyStorable afs = new MarkedOnlyStorable(false);
     1713      MarkedOnlyStorable afs = new MarkedOnlyStorable();
     1714      afs.InitValues();
    16991715      serializer.Serialize(afs, tempFile);
    17001716      MarkedOnlyStorable newAfs = (MarkedOnlyStorable)serializer.Deserialize(tempFile);
Note: See TracChangeset for help on using the changeset viewer.