Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/12/10 10:43:08 (14 years ago)
Author:
epitzer
Message:

invoke storable hooks in more predictable orders, call hooks defined on base classes first. (#548)

File:
1 edited

Legend:

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

    r3005 r3010  
    784784    }
    785785
     786    [StorableClass(StorableClassType.MarkedOnly)]
     787    public class HookInheritanceTestBase {
     788      [Storable]
     789      public object a;
     790      public object link;
     791      [StorableHook(HookType.AfterDeserialization)]
     792      private void relink() {
     793        link = a;
     794      }
     795    }
     796
     797    [StorableClass(StorableClassType.Empty)]
     798    public class HookInheritanceTestDerivedClass : HookInheritanceTestBase {
     799      [Storable]
     800      public object b;
     801      [StorableHook(HookType.AfterDeserialization)]
     802      private void relink() {
     803        Assert.AreSame(a, link);
     804        link = b;
     805      }
     806    }
     807
     808    [TestMethod]
     809    public void TestLinkInheritance() {
     810      HookInheritanceTestDerivedClass c = new HookInheritanceTestDerivedClass();
     811      c.a = new object();
     812      XmlGenerator.Serialize(c, tempFile);
     813      HookInheritanceTestDerivedClass newC = (HookInheritanceTestDerivedClass)XmlParser.Deserialize(tempFile);
     814      Assert.AreSame(c.b, c.link);
     815    }
     816
    786817    [ClassInitialize]
    787818    public static void Initialize(TestContext testContext) {
Note: See TracChangeset for help on using the changeset viewer.