public static ErrorInfo Report(Exception exception, IDictionary<string, object> propeties) { if (exception == null) { throw new ArgumentNullException("exception"); } ErrorInfo error = null; if (IsEnabled) { error = new ErrorInfo(exception) { ApplicationName = _parameters.ApplicationName, Host = _parameters.Host, Appenders = _appenders, Properties = propeties }; error.EnsureAppenders(); _writter.Write(_parameters.Token, error); } return error; }
public void ShouldAppend_Appender_Data_Test() { // Arrange var appenders = new List<Type> { typeof(FirstAppender), typeof(SecondAppender) }; ErrorInfo error = new ErrorInfo(new Exception("Test-Exception")); error.Appenders = appenders; error.EnsureAppenders(); // Act string detail = error.BuildMessage(); // Assert Assert.True(detail.Contains("FirstAppender")); Assert.True(detail.Contains("SecondAppender")); Assert.True(detail.Contains("FirstKey")); Assert.True(detail.Contains("FirstValue")); Assert.True(detail.Contains("SecondKey")); Assert.True(detail.Contains("SecondValue")); }