Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/26/10 15:46:10 (14 years ago)
Author:
epitzer
Message:

Always instantiate parent before processing an inner composite. (#888)

File:
1 edited

Legend:

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

    r2859 r2873  
    581581    }
    582582
     583    class Child {
     584      [Storable]
     585      public GrandParent grandParent;
     586    }
     587
     588    class Parent {
     589      [Storable]
     590      public Child child;
     591    }
     592
     593    class GrandParent {
     594      [Storable]
     595      public Parent parent;
     596    }
     597
     598    [TestMethod]
     599    public void InstantiateParentChainReference() {
     600      GrandParent gp = new GrandParent();
     601      gp.parent = new Parent();
     602      gp.parent.child = new Child();
     603      gp.parent.child.grandParent = gp;
     604      Assert.AreSame(gp, gp.parent.child.grandParent);
     605      XmlGenerator.Serialize(gp, tempFile);
     606      GrandParent newGp = (GrandParent)XmlParser.Deserialize(tempFile);
     607      Assert.AreSame(newGp, newGp.parent.child.grandParent);
     608    }
     609
    583610    [ClassInitialize]
    584611    public static void Initialize(TestContext testContext) {
Note: See TracChangeset for help on using the changeset viewer.