public void TestExpectedExceptionSerialize()
        {
            ExpectedException obj = new ExpectedException();
            ExceptionBase eb = new ExceptionBase(obj);

            DataContractSerializer formater = new DataContractSerializer(typeof(ExceptionBase));

            using (Stream stream = new MemoryStream())
            {
                formater.WriteObject(stream, eb);
                stream.Seek(0, SeekOrigin.Begin);
                ExceptionBase exception = (ExceptionBase)formater.ReadObject(stream);
            }
        }
Example #2
0
 protected ExceptionBase Clone()
 {
     var ex = new ExceptionBase(this.Message)
     {
         data = this.data,
         AssemblyName = this.GetType().Assembly.FullName,
         TypeName = this.GetType().FullName
     };
     ex.Data["_StackTree"] = this.StackTrace;
     ex.Data["_Source"] = this.Source;
     return ex;
 }