public void ByteSerializer_SerializeThenDeserialzeViaStream_CorrectlyInflatesData() { var data = new SerializeToBytesTester(69); SerializeToBytesTester deserializedData = null; using (var memory = new System.IO.MemoryStream()) { data.Serialize(memory, Encoding.ASCII); memory.Seek(0, System.IO.SeekOrigin.Begin); deserializedData = SerializeToBytesTester.Inflate <SerializeToBytesTester>(memory); } Assert.Equal(data.MuhDater, deserializedData.MuhDater); }
public void ByteSerializer_SerializeThenDeserialzeViaBinaryReaderWriter_CorrectlyInflatesData() { var data = new SerializeToBytesTester(42); SerializeToBytesTester deserializedData = null; using (var memory = new System.IO.MemoryStream()) { using (var writer = new BinaryWriter(memory)) { data.Serialize(writer); } using (var reader = new BinaryReader(memory)) { memory.Seek(0, System.IO.SeekOrigin.Begin); deserializedData = SerializeToBytesTester.Inflate <SerializeToBytesTester>(reader); } } Assert.Equal(data.MuhDater, deserializedData.MuhDater); }