public void Arrays() { object[] array1 = new object[] { "Foo", 1, 3.0 }; DateTime[] array2 = new DateTime[] { DateTime.MinValue, DateTime.MaxValue }; FlattenedSerializationInfo serializationInfo = new FlattenedSerializationInfo(); serializationInfo.AddArray(array1); serializationInfo.AddArray(array2); object[] data = serializationInfo.GetData(); FlattenedDeserializationInfo deserializationInfo = new FlattenedDeserializationInfo(data); Assert.That(deserializationInfo.GetArray <object> (), Is.EqualTo(array1)); Assert.That(deserializationInfo.GetArray <DateTime> (), Is.EqualTo(array2)); }
protected RelationEndPointMap(FlattenedDeserializationInfo info) : this(info.GetValueForHandle <IClientTransactionEventSink>()) { var endPointArray = info.GetArray <IRelationEndPoint> (); foreach (IRelationEndPoint endPoint in endPointArray) { _relationEndPoints.Add(endPoint.ID, endPoint); } }
public void InvalidArrayType() { object[] array1 = new object[] { "Foo", 1, 3.0 }; FlattenedSerializationInfo serializationInfo = new FlattenedSerializationInfo(); serializationInfo.AddArray(array1); object[] data = serializationInfo.GetData(); FlattenedDeserializationInfo deserializationInfo = new FlattenedDeserializationInfo(data); deserializationInfo.GetArray <int> (); }
public void ArrayWithFlattenedSerializables() { FlattenedSerializableStub stub1 = new FlattenedSerializableStub("begone, foul fiend", 123); FlattenedSerializableStub stub2 = new FlattenedSerializableStub("'twas brillig, and the slithy toves", 124); object[] stubs = new object[] { stub1, stub2 }; FlattenedSerializationInfo serializationInfo = new FlattenedSerializationInfo(); serializationInfo.AddArray(stubs); object[] data = serializationInfo.GetData(); FlattenedDeserializationInfo deserializationInfo = new FlattenedDeserializationInfo(data); object[] deserializedStubs = deserializationInfo.GetArray <object> (); Assert.That(deserializedStubs.Length, Is.EqualTo(2)); Assert.That(((FlattenedSerializableStub)deserializedStubs[0]).Data1, Is.EqualTo("begone, foul fiend")); Assert.That(((FlattenedSerializableStub)deserializedStubs[0]).Data2, Is.EqualTo(123)); Assert.That(((FlattenedSerializableStub)deserializedStubs[1]).Data1, Is.EqualTo("'twas brillig, and the slithy toves")); Assert.That(((FlattenedSerializableStub)deserializedStubs[1]).Data2, Is.EqualTo(124)); }