public void SerializationUnsafeRoundtrip() { Stream s = GetSerializedStream(); BinaryFormatter bf = new BinaryFormatter(); SerializationTest clone = (SerializationTest)bf.UnsafeDeserialize(s, null); Assert.AreEqual(Int32.MinValue, clone.Integer, "Integer"); Assert.IsFalse(clone.Boolean, "Boolean"); }
public Stream GetSerializedStream() { SerializationTest test = new SerializationTest(true, Int32.MinValue); BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(); bf.Serialize(ms, test); ms.Position = 0; return(ms); }
public Stream GetSerializedStream () { SerializationTest test = new SerializationTest (true, Int32.MinValue); BinaryFormatter bf = new BinaryFormatter (); MemoryStream ms = new MemoryStream (); bf.Serialize (ms, test); ms.Position = 0; return ms; }