예제 #1
0
        public void GetObjectData_Null()
        {
            StreamingContext sc = new StreamingContext();
            CompressedStack  cs = CompressedStack.Capture();

            cs.GetObjectData(null, sc);
        }
예제 #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();
        }