public void TestConstructor1() { MessageParsingException ose = new MessageParsingException(); Assert.IsTrue(ose is ApplicationException, "MessageParsingException does not derive from ApplicationException"); }
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"); }
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."); }