public void TestConstructor1() { XmlTreeViewException oce = new XmlTreeViewException(); Assert.IsTrue(oce is XmlTreeViewException, "Exception instance is not of type XmlTreeViewException"); Assert.IsTrue(oce is ApplicationException, "Exception instance is not of type ApplicationException"); }
public void TestConstructor2() { XmlTreeViewException oce = new XmlTreeViewException("abc"); Assert.IsTrue(oce is XmlTreeViewException, "Exception instance is not of type XmlTreeViewException"); Assert.AreEqual(oce.Message, "abc", "Wrong constructor implementation"); }
public void ConstructorSerializationTest() { BinaryFormatter bf = new BinaryFormatter(); MemoryStream stream = new MemoryStream(); XmlTreeViewException ex1 = new XmlTreeViewException("Failed"); bf.Serialize(stream, ex1); stream.Flush(); stream.Seek(0, SeekOrigin.Begin); XmlTreeViewException ex2 = (XmlTreeViewException)bf.Deserialize(stream); Assert.AreEqual(ex1.Message, ex2.Message, "Error message should be correct."); }