コード例 #1
0
        public void TestCtor()
        {
            Exception ex = new BindDataInvalidException();

            Assert.IsTrue(ex is ApplicationException, "Wrong definiton of exception class.");
            Assert.IsTrue(ex is DateDropDownException, "Wrong definiton of exception class.");
        }
コード例 #2
0
        public void TestCtorMessageInner_Valid()
        {
            Exception e = new BindDataInvalidException(message, cause);

            Assert.AreEqual(message, e.Message, "e.Message should be equal to message.");
            Assert.AreEqual(cause, e.InnerException, "e.InnerException should be equal to cause.");
        }
コード例 #3
0
        public void TestCtorInfoContext()
        {
            // Stream for serialization.
            using (Stream stream = new MemoryStream())
            {
                // Serialize the instance.
                BindDataInvalidException serial =
                    new BindDataInvalidException(message, cause);
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(stream, serial);

                // Deserialize the instance.
                stream.Seek(0, SeekOrigin.Begin);
                BindDataInvalidException deserial =
                    formatter.Deserialize(stream) as BindDataInvalidException;

                // Verify the instance.
                Assert.IsFalse(serial == deserial, "Instance not deserialized.");
                Assert.AreEqual(serial.Message, deserial.Message, "Message mismatches.");
                Assert.AreEqual(serial.InnerException.Message, deserial.InnerException.Message,
                                "InnerException mismatches.");
            }
        }
コード例 #4
0
        public void TestCtorMessageInner_Null2()
        {
            Exception e = new BindDataInvalidException(null, cause);

            Assert.AreEqual(cause, e.InnerException, "e.InnerException should be equal to cause.");
        }
コード例 #5
0
        public void TestCtorMessageInner_Null1()
        {
            Exception e = new BindDataInvalidException(message, null);

            Assert.AreEqual(message, e.Message, "e.Message should be equal to message.");
        }