Example #1
0
        public void TestConstructor1()
        {
            InvalidXmlException oce = new InvalidXmlException();

            Assert.IsTrue(oce is InvalidXmlException, "Exception instance is not of type InvalidXmlException");
            Assert.IsTrue(oce is XmlTreeViewException, "Exception instance is not of type XmlTreeViewException");
        }
Example #2
0
        public void TestConstructor2()
        {
            InvalidXmlException oce = new InvalidXmlException("abc");

            Assert.IsTrue(oce is InvalidXmlException,
                          "Exception instance is not of type InvalidXmlException");
            Assert.AreEqual(oce.Message, "abc", "Wrong constructor implementation");
        }
Example #3
0
        public void TestConstructor3()
        {
            Exception           e   = new Exception("def");
            InvalidXmlException oce = new InvalidXmlException("abc", e);

            Assert.IsTrue(oce is InvalidXmlException,
                          "Exception instance is not of type InvalidXmlException");
            Assert.AreEqual(oce.Message, "abc", "Wrong constructor implementation");
            Assert.AreEqual(oce.InnerException, e, "Wrong constructor implementation");
            Assert.AreEqual(oce.InnerException.Message, "def", "Wrong constructor implementation");
        }
Example #4
0
        public void ConstructorSerializationTest()
        {
            BinaryFormatter bf     = new BinaryFormatter();
            MemoryStream    stream = new MemoryStream();

            InvalidXmlException ex1 = new InvalidXmlException("Failed");

            bf.Serialize(stream, ex1);

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

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

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