diff --git a/src/NLog.StructuredLogging.Json.Tests/Helpers/MapperExceptionLoggingTests.cs b/src/NLog.StructuredLogging.Json.Tests/Helpers/MapperExceptionLoggingTests.cs index 86012f7..2ac18c0 100644 --- a/src/NLog.StructuredLogging.Json.Tests/Helpers/MapperExceptionLoggingTests.cs +++ b/src/NLog.StructuredLogging.Json.Tests/Helpers/MapperExceptionLoggingTests.cs @@ -58,7 +58,12 @@ public void When_ExceptionHasStackTraceData_StackTraceIsLogged() var result = Mapper.ToDictionary(logEventInfo); Assert.That(result.ContainsKey("ExceptionStackTrace"), Is.True); - Assert.That(result["ExceptionStackTrace"], Does.StartWith(" at NLog.StructuredLogging.Json.Tests.Helpers.MapperExceptionLoggingTests.GenerateExceptionWithStackTrace()")); + Assert.That(NormaliseStackTrace(result["ExceptionStackTrace"].ToString()), Does.StartWith("at NLog.StructuredLogging.Json.Tests.Helpers.MapperExceptionLoggingTests.GenerateExceptionWithStackTrace()")); + + string NormaliseStackTrace(string exception) + { + return exception.TrimStart(' ').Replace(" ()", "()"); + } } [Test]