コード例 #1
0
        public void ctor_SerializationInfo_StreamingContext()
        {
            var expected = new TranslationException("test");
            TranslationException actual;

            using (var stream = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                formatter.Serialize(stream, new TranslationException("test"));
                stream.Position = 0;
                actual = (TranslationException)formatter.Deserialize(stream);
            }

            Assert.Equal(expected.Message, actual.Message);
        }
コード例 #2
0
        public void ctor_SerializationInfo_StreamingContext()
        {
            var expected = new TranslationException("test");
            TranslationException actual;

            using (var stream = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                formatter.Serialize(stream, new TranslationException("test"));
                stream.Position = 0;
                actual          = (TranslationException)formatter.Deserialize(stream);
            }

            Assert.Equal(expected.Message, actual.Message);
        }