Inheritance: SmtpException
Beispiel #1
0
        public void TestConstructorWithSerialization()
        {
            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.NotNull(se.Data);
            Assert.Equal(0, se.Data.Keys.Count);
            Assert.Same(inner, se.InnerException);
            Assert.Same(msg, se.Message);
            Assert.Equal(SmtpStatusCode.ServiceReady, se.StatusCode);
        }
Beispiel #2
0
        public void TestConstructorWithSerialization()
        {
            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.NotNull(se.Data);
            Assert.Equal(0, se.Data.Keys.Count);
            Assert.Same(inner, se.InnerException);
            Assert.Same(msg, se.Message);
            Assert.Equal(SmtpStatusCode.ServiceReady, se.StatusCode);
        }