diff --git a/NLog.Owin.Logging.Tests/OwinLoggerTest.cs b/NLog.Owin.Logging.Tests/OwinLoggerTest.cs index c732c45..f3a4bd1 100644 --- a/NLog.Owin.Logging.Tests/OwinLoggerTest.cs +++ b/NLog.Owin.Logging.Tests/OwinLoggerTest.cs @@ -15,7 +15,7 @@ public class OwinLoggerTest : OwinLoggerTestBase public void InitConfig() { // setup the debug target - _debugTarget = new DebugTarget { Layout = "${level} ${message}" }; + _debugTarget = new DebugTarget { Layout = "${level} EventId:${event-properties:item=EventId} ${message}" }; var loggingConfiguration = new LoggingConfiguration(); @@ -59,5 +59,15 @@ public void TestUnknownEventType() { Assert.ThrowsAsync (() => CallRoute("/invalid")); } + + [Test] + public async Task TestWriteCoreWithEventId() + { + await CallRoute("/eventid"); + + // note: hardcoded event id = 140 in OwinTestApp.cs + Assert.That(_debugTarget.LastMessage, Does.StartWith("Info")); + Assert.That(_debugTarget.LastMessage, Does.Contain("EventId:140")); + } } } \ No newline at end of file diff --git a/NLog.Owin.Logging.Tests/OwinTestApp.cs b/NLog.Owin.Logging.Tests/OwinTestApp.cs index e5cbf8b..87232d9 100644 --- a/NLog.Owin.Logging.Tests/OwinTestApp.cs +++ b/NLog.Owin.Logging.Tests/OwinTestApp.cs @@ -51,6 +51,9 @@ public override async Task Invoke(IOwinContext context) case "/verbose": _logger.WriteVerbose("verbose"); break; + case "/eventid": + _logger.WriteCore(TraceEventType.Information, 140, "test", null, (message, error) => (string)message); + break; case "/invalid": { //write invalid TraceEventType