public void CtorMessageTest () { LoggerException le; string message = "message"; le = new LoggerException (message); Assert.AreEqual (message, le.Message, "Message"); Assert.AreEqual (null, le.ErrorCode, "ErrorCode"); Assert.AreEqual (null, le.HelpKeyword, "HelpKeyword"); }
public void CtorMessageExceptionTest () { LoggerException le; string message = "message"; Exception e = new Exception ("Inner exception message"); le = new LoggerException (message, e); Assert.AreEqual (message, le.Message, "Message"); Assert.AreEqual (e, le.InnerException, "InnerException"); Assert.AreEqual (null, le.ErrorCode, "ErrorCode"); Assert.AreEqual (null, le.HelpKeyword, "HelpKeyword"); }
public void CtorMessageExceptionCodeTest () { LoggerException le; string message = "message"; string errorCode = "CS0000"; string helpKeyword = "helpKeyword"; Exception e = new Exception ("Inner exception message"); le = new LoggerException (message, e, errorCode, helpKeyword); Assert.AreEqual (message, le.Message, "Message"); Assert.AreEqual (e, le.InnerException, "InnerException"); Assert.AreEqual (errorCode, le.ErrorCode, "ErrorCode"); Assert.AreEqual (helpKeyword, le.HelpKeyword, "HelpKeyword"); }
public void SerializeDeserialize2() { LoggerException e = new LoggerException("message"); using (MemoryStream memstr = new MemoryStream()) { BinaryFormatter frm = new BinaryFormatter(); frm.Serialize(memstr, e); memstr.Position = 0; LoggerException e2 = (LoggerException)frm.Deserialize(memstr); Assert.AreEqual(null, e2.ErrorCode); Assert.AreEqual(null, e2.HelpKeyword); Assert.AreEqual(e.Message, e2.Message); Assert.AreEqual(null, e2.InnerException); } }
public void TestGetObjectData2 () { StreamingContext sc = new StreamingContext (); SerializationInfo si = new SerializationInfo (typeof (LoggerException), new FormatterConverter ()); LoggerException le; string message = "message"; string errorCode = "CS0000"; string helpKeyword = "helpKeyword"; Exception e = new Exception ("Inner exception message"); le = new LoggerException (message, e, errorCode, helpKeyword); le.GetObjectData (si, sc); Assert.AreEqual (errorCode, si.GetString ("errorCode"), "A1"); Assert.AreEqual (helpKeyword, si.GetString ("helpKeyword"), "A2"); }
public void TestGetObjectData1 () { LoggerException le = new LoggerException (); le.GetObjectData (null, new StreamingContext ()); }