public void HandlesObjectsWithThrowingToString() { var msg = new ParsedLogMessage(Formatter.Format(LogLevel.Debug, new Throwy(), null)).Message; StringAssert.Contains("The log message was non-null, but 'Throwy.ToString()' threw an exception", msg); StringAssert.Contains("I'm sorry, Dave, I'm afraid I can't do that", msg); }
public void IncludesExceptions() { try { ThrowyFunction(); throw new Exception("Expected an exception to be thrown"); } catch (Exception e) { var msg = new ParsedLogMessage(Formatter.Format(LogLevel.Debug, "foo", e)).Message; StringAssert.StartsWith("foo Exception:", msg); StringAssert.Contains("Something went wrong here", msg); StringAssert.Contains("ThrowyFunction", msg); } }