コード例 #1
0
        public void TestConstructor1()
        {
            MessageParsingException ose = new MessageParsingException();

            Assert.IsTrue(ose is ApplicationException,
                          "MessageParsingException does not derive from ApplicationException");
        }
コード例 #2
0
        public void TestConstructor2()
        {
            MessageParsingException ose = new MessageParsingException("abc");

            Assert.IsTrue(ose is ApplicationException,
                          "MessageParsingException does not derive from ApplicationException");
            Assert.AreEqual(ose.Message, "abc", "Wrong constructor implementation");
        }
コード例 #3
0
        public void ConstructorSerializationTest()
        {
            BinaryFormatter bf     = new BinaryFormatter();
            MemoryStream    stream = new MemoryStream();

            MessageParsingException ex1 = new MessageParsingException("Failed");

            bf.Serialize(stream, ex1);

            stream.Flush();
            stream.Seek(0, SeekOrigin.Begin);

            MessageParsingException ex2 = (MessageParsingException)bf.Deserialize(stream);

            Assert.AreEqual(ex1.Message, ex2.Message, "Error message should be correct.");
        }