/// <summary> /// Render layout <paramref name="layout"/> with <paramref name="logEventInfo"/> and compare result with <paramref name="expected"/>. /// </summary> protected static void AssertLayoutRendererOutput(Layout layout, LogEventInfo logEventInfo, string expected) { layout.Initialize(null); string actual = layout.Render(logEventInfo); layout.Close(); Assert.Equal(expected, actual); }
/// <summary> /// Initializes the layout. /// </summary> public void Initialize() { Layout.Initialize(); if (Header != null) { Header.Initialize(); } if (Footer != null) { Footer.Initialize(); } }
protected void AssertLayoutRendererOutput(Layout l, string expected) { l.Initialize(null); string actual = l.Render(LogEventInfo.Create(LogLevel.Info, "loggername", "message")); l.Close(); Assert.AreEqual(expected, actual); }