public void TestSerializationService_CreatePortableReader() { var serializationService = new SerializationServiceBuilder(new NullLoggerFactory()).Build(); var timestamp1 = TestUtils.RandomLong(); var child = new ChildPortableObject(timestamp1); var timestamp2 = TestUtils.RandomLong(); var parent = new ParentPortableObject(timestamp2, child); var timestamp3 = timestamp1 + timestamp2; var grandParent = new GrandParentPortableObject(timestamp3, parent); var data = serializationService.ToData(grandParent); var reader = serializationService.CreatePortableReader(data); Assert.AreEqual(grandParent.timestamp, reader.ReadLong("timestamp")); Assert.AreEqual(parent.timestamp, reader.ReadLong("child.timestamp")); Assert.AreEqual(child.timestamp, reader.ReadLong("child.child.timestamp")); }
/// <exception cref="System.IO.IOException"/> public virtual void ReadPortable(IPortableReader reader) { timestamp = reader.ReadLong("timestamp"); child = reader.ReadPortable <ChildPortableObject>("child"); }
public ParentPortableObject(long timestamp, ChildPortableObject child) { this.timestamp = timestamp; this.child = child; }
public ParentPortableObject(long timestamp) { this.timestamp = timestamp; child = new ChildPortableObject(timestamp); }