[Test] // .ctor (SerializationInfo, StreamingContext) public void Constructor4() { string msg = "MESSAGE"; Exception inner = new ArgumentException("whatever"); SerializationInfo si = new SerializationInfo( typeof(SmtpException), new FormatterConverter()); new Exception(msg, inner).GetObjectData(si, new StreamingContext()); si.AddValue("Status", (int)SmtpStatusCode.ServiceReady); SmtpException se = new MySmtpException(si, new StreamingContext()); Assert.IsNotNull(se.Data, "#1"); Assert.AreEqual(0, se.Data.Keys.Count, "#2"); Assert.AreSame(inner, se.InnerException, "#3"); Assert.AreSame(msg, se.Message, "#4"); Assert.AreEqual(SmtpStatusCode.ServiceReady, se.StatusCode, "#5"); }
[Test] // .ctor (SerializationInfo, StreamingContext) public void Constructor4 () { string msg = "MESSAGE"; Exception inner = new ArgumentException ("whatever"); SerializationInfo si = new SerializationInfo ( typeof (SmtpException), new FormatterConverter ()); new Exception (msg, inner).GetObjectData (si, new StreamingContext ()); si.AddValue ("Status", (int) SmtpStatusCode.ServiceReady); SmtpException se = new MySmtpException (si, new StreamingContext ()); Assert.IsNotNull (se.Data, "#1"); Assert.AreEqual (0, se.Data.Keys.Count, "#2"); Assert.AreSame (inner, se.InnerException, "#3"); Assert.AreSame (msg, se.Message, "#4"); Assert.AreEqual (SmtpStatusCode.ServiceReady, se.StatusCode, "#5"); }