public void format_a_simple_exception() { try { var exception = new NotImplementedException(); var sut = new BaseLoggerWrapper(GetType()); var actual = sut.FormatException(exception); Assert.AreEqual(actual.StartsWith(" System.NotImplementedException"), true); Assert.Fail("no exception thrown"); } catch (Exception ex) { Assert.IsTrue(ex is Exception); } }
public void ignore_null_properties_in_the_exception_output() { try { var exception = new ExceptionWithProperty2() { UserId = 10 }; var sut = new BaseLoggerWrapper(GetType()); var actual = sut.FormatException(exception); Assert.AreEqual(actual.StartsWith(" MicroServer.Tests.Logging.Loggers.ExceptionWithProperty2"), true); Assert.AreEqual(actual.EndsWith("[UserId='10']\r\n"), true); } catch (Exception ex) { Assert.IsTrue(ex is Exception); } }
public void include_properties_in_the_exception_output() { try { var exception = new ExceptionWithProperty2() { UserId = 10, FirstName = "Arne" }; var sut = new BaseLoggerWrapper(GetType()); var actual = sut.FormatException(exception); Debug.WriteLine(actual.ToString()); Assert.AreEqual(actual.StartsWith(" MicroServer.Tests.Logging.Loggers.ExceptionWithProperty2"), true); Assert.AreEqual(actual.EndsWith("[UserId='10',FirstName='Arne']\r\n"), true); } catch (Exception ex) { Assert.IsTrue(ex is Exception); } }
public void ignore_null_properties_in_the_exception_output() { try { var exception = new ExceptionWithProperty2() { UserId = 10 }; var sut = new BaseLoggerWrapper(GetType()); var actual = sut.FormatException(exception); Assert.AreEqual(actual.StartsWith(" MicroServer.Tests.Logging.Loggers.ExceptionWithProperty2"), true); Assert.AreEqual(actual.EndsWith("[UserId='10']\r\n"), true); } catch (Exception ex) { Assert.IsTrue(ex is Exception); } }
public void include_properties_in_the_exception_output() { try { var exception = new ExceptionWithProperty2() { UserId = 10, FirstName = "Arne" }; var sut = new BaseLoggerWrapper(GetType()); var actual = sut.FormatException(exception); Debug.WriteLine(actual.ToString()); Assert.AreEqual(actual.StartsWith(" MicroServer.Tests.Logging.Loggers.ExceptionWithProperty2"), true); Assert.AreEqual(actual.EndsWith("[UserId='10',FirstName='Arne']\r\n"), true); } catch (Exception ex) { Assert.IsTrue(ex is Exception); } }
public void format_a_simple_exception() { try { var exception = new NotImplementedException(); var sut = new BaseLoggerWrapper(GetType()); var actual = sut.FormatException(exception); Assert.AreEqual(actual.StartsWith(" System.NotImplementedException"), true); Assert.Fail("no exception thrown"); } catch (Exception ex) { Assert.IsTrue(ex is Exception); } }