示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }