Esempio n. 1
0
        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"));
        }
Esempio n. 2
0
 /// <exception cref="System.IO.IOException"/>
 public virtual void ReadPortable(IPortableReader reader)
 {
     timestamp = reader.ReadLong("timestamp");
     child     = reader.ReadPortable <ChildPortableObject>("child");
 }
Esempio n. 3
0
 public ParentPortableObject(long timestamp, ChildPortableObject child)
 {
     this.timestamp = timestamp;
     this.child     = child;
 }
Esempio n. 4
0
 public ParentPortableObject(long timestamp)
 {
     this.timestamp = timestamp;
     child          = new ChildPortableObject(timestamp);
 }