Ejemplo n.º 1
0
        public void GetObjectData_Null()
        {
            StreamingContext sc = new StreamingContext();
            CompressedStack  cs = CompressedStack.Capture();

            cs.GetObjectData(null, sc);
        }
Ejemplo n.º 2
0
        public static void SerializationTest()
        {
            CompressedStack compressedStack = CompressedStack.Capture();

            Assert.Throws <ArgumentNullException>(() => compressedStack.GetObjectData(null, new StreamingContext()));

            var binaryFormatter = new BinaryFormatter();
            var memoryStream    = new MemoryStream();

            binaryFormatter.Serialize(memoryStream, compressedStack);
            memoryStream.Close();
            byte[] binaryData = memoryStream.ToArray();

            memoryStream    = new MemoryStream(binaryData);
            compressedStack = (CompressedStack)binaryFormatter.Deserialize(memoryStream);
            memoryStream.Close();
        }