public void UseAppSettingTest() { var configurationManager = new MockConfigurationManager(); const string expected = "appSettingTestValue"; configurationManager.AppSettings["appSettingTestKey"] = expected; var appSettingLayoutRenderer = new AppSettingLayoutRenderer { ConfigurationManager = configurationManager, Name = "appSettingTestKey", }; var rendered = appSettingLayoutRenderer.Render(LogEventInfo.CreateNullEvent()); Assert.Equal(expected, rendered); }
public void NoAppSettingTest() { var configurationManager = new MockConfigurationManager(); var appSettingLayoutRenderer = new AppSettingLayoutRenderer { ConfigurationManager = configurationManager, Name = "notFound", }; var rendered = appSettingLayoutRenderer.Render(LogEventInfo.CreateNullEvent()); Assert.Equal(string.Empty, rendered); }
public void FallbackToDefaultTest() { var configurationManager = new MockConfigurationManager(); const string expected = "UseDefault"; var appSettingLayoutRenderer = new AppSettingLayoutRenderer { ConfigurationManager = configurationManager, Name = "notFound", Default = "UseDefault", }; var rendered = appSettingLayoutRenderer.Render(LogEventInfo.CreateNullEvent()); Assert.Equal(expected, rendered); }