public virtual void TestInputOutputWithPortableReader(ByteOrder byteOrder) { var portable = KitchenSinkPortable.Generate(); var config = new SerializationConfig(); config.AddPortableFactoryClass(KitchenSinkPortableFactory.FactoryId, typeof (KitchenSinkPortableFactory)); var ss = new SerializationServiceBuilder().SetConfig(config). SetUseNativeByteOrder(false).SetByteOrder(byteOrder).Build(); var data = ss.ToData(portable); var reader = ss.CreatePortableReader(data); var actual = new KitchenSinkPortable(); actual.ReadPortable(reader); Assert.AreEqual(portable, actual); ss.Destroy(); }
public void TestSerializationService_CreatePortableReader() { var serializationService = new SerializationServiceBuilder().Build(); var timestamp1 = TestSupport.RandomLong(); var child = new ChildPortableObject(timestamp1); var timestamp2 = TestSupport.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")); }