public void NoAppSettingTest() { var configurationManager = new MockConfigurationManager(); var appSettingLayoutRenderer = new AppSettingLayoutRenderer2 { ConfigurationManager = configurationManager, Item = "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 AppSettingLayoutRenderer2 { ConfigurationManager = configurationManager, Item = "notFound", Default = "UseDefault", }; var rendered = appSettingLayoutRenderer.Render(LogEventInfo.CreateNullEvent()); Assert.Equal(expected, rendered); }
public void UseAppSettingTest() { var configurationManager = new MockConfigurationManager(); const string expected = "appSettingTestValue"; configurationManager.AppSettings["appSettingTestKey"] = expected; var appSettingLayoutRenderer = new AppSettingLayoutRenderer2 { ConfigurationManager = configurationManager, Item = "appSettingTestKey", }; var rendered = appSettingLayoutRenderer.Render(LogEventInfo.CreateNullEvent()); Assert.Equal(expected, rendered); }
public void UseConnectionStringTest() { var configurationManager = new MockConfigurationManager(); const string expected = "Hello Connection"; configurationManager.ConnectionStrings["myConnection"] = new ConnectionStringSettings() { ConnectionString = expected }; var appSettingLayoutRenderer = new AppSettingLayoutRenderer2 { ConfigurationManager = configurationManager, Item = "ConnectionStrings.myConnection", }; var rendered = appSettingLayoutRenderer.Render(LogEventInfo.CreateNullEvent()); Assert.Equal(expected, rendered); }