Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/09/10 18:57:40 (15 years ago)
Author:
epitzer
Message:

add support for new StorableConstructor attribute (#900)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Tests/UseCases.cs

    r2980 r2983  
    692692      Assert.IsFalse(newHookTest.WasSerialized);
    693693    }
     694   
     695    [EmptyStorableClass]
     696    private class CustomConstructor {
     697      public string Value = "none";
     698      public CustomConstructor() {
     699        Value = "default";
     700      }
     701      [StorableConstructor]
     702      private CustomConstructor(bool deserializing) {
     703        Assert.IsTrue(deserializing);
     704        Value = "persistence";
     705      }
     706    }
     707
     708    [TestMethod]
     709    public void TestCustomConstructor() {
     710      CustomConstructor cc = new CustomConstructor();
     711      Assert.AreEqual(cc.Value, "default");
     712      XmlGenerator.Serialize(cc, tempFile);
     713      CustomConstructor newCC = (CustomConstructor)XmlParser.Deserialize(tempFile);
     714      Assert.AreEqual(newCC.Value, "persistence");
     715    }
    694716
    695717    [ClassInitialize]
Note: See TracChangeset for help on using the changeset viewer.