public void SignalDeserializationFinished() { var serializationInfo = new FlattenedSerializationInfo(); serializationInfo.AddValue(1); serializationInfo.AddValue(2); serializationInfo.AddValue("three"); bool deserializationFinishedCalled = false; object deserializationFinishedSender = null; var deserializationInfo = new FlattenedDeserializationInfo(serializationInfo.GetData()); deserializationInfo.DeserializationFinished += (sender, args) => { deserializationFinishedCalled = true; deserializationFinishedSender = sender; }; var o = deserializationInfo.GetValue <object> (); Assert.That(o, Is.EqualTo(1)); o = deserializationInfo.GetValue <object> (); Assert.That(o, Is.EqualTo(2)); o = deserializationInfo.GetValue <object> (); Assert.That(o, Is.EqualTo("three")); Assert.That(deserializationFinishedCalled, Is.False); deserializationInfo.SignalDeserializationFinished(); Assert.That(deserializationFinishedCalled, Is.True); Assert.That(deserializationFinishedSender, Is.SameAs(deserializationInfo)); }
public static T Deserialize <T> (object[] data) where T : IFlattenedSerializable { FlattenedDeserializationInfo info = new FlattenedDeserializationInfo(data); var value = info.GetValue <T>(); info.SignalDeserializationFinished(); return(value); }
public void SignalDeserializationFinished_BeforeObjectStreamFinished() { var serializationInfo = new FlattenedSerializationInfo(); serializationInfo.AddValue(DateTime.Now); var deserializationInfo = new FlattenedDeserializationInfo(serializationInfo.GetData()); deserializationInfo.SignalDeserializationFinished(); }
public void SignalDeserializationFinished_BeforeBoolStreamFinished() { var serializationInfo = new FlattenedSerializationInfo(); serializationInfo.AddBoolValue(true); var deserializationInfo = new FlattenedDeserializationInfo(serializationInfo.GetData()); deserializationInfo.SignalDeserializationFinished(); }
void IDeserializationCallback.OnDeserialization(object sender) { var doInfo = new FlattenedDeserializationInfo(_deserializedData); _clientTransaction = doInfo.GetValueForHandle <ClientTransaction> (); _transactionEventSink = doInfo.GetValueForHandle <IClientTransactionEventSink> (); _dataContainerEventListener = doInfo.GetValueForHandle <IDataContainerEventListener> (); _dataContainerMap = doInfo.GetValue <DataContainerMap>(); _relationEndPointManager = doInfo.GetValueForHandle <RelationEndPointManager>(); _domainObjectStateCache = doInfo.GetValue <DomainObjectStateCache>(); _invalidDomainObjectManager = doInfo.GetValue <IInvalidDomainObjectManager> (); _objectLoader = doInfo.GetValueForHandle <IObjectLoader>(); _deserializedData = null; doInfo.SignalDeserializationFinished(); }