Exemplo n.º 1
0
        public void Build_NoEnvVarFileExist_ProductionConfigStore()
        {
            IConfigStore configStore = new EnvironmentFileBuilder().Build(_path);

            Assert.False(bool.Parse(configStore.Read("Logging.IncludeScopes")));

            Assert.Equal("Debug", configStore.Read("Logging.LogLevel.Default"));
            Assert.Equal("Information", configStore.Read("Logging.LogLevel.System"));
            Assert.Equal("Information", configStore.Read("Logging.LogLevel.Microsoft"));

            Assert.Equal("c75aaedd-7e93-4f67-b7b7-526f7924ccaa", configStore.Read("ApplicationInsights.InstrumentationKey"));

            Assert.Equal("1", configStore.Read("Numbers[0]"));
            Assert.Equal("2", configStore.Read("Numbers[1]"));
            Assert.Equal("3", configStore.Read("Numbers[2]"));

            Assert.Equal("user1", configStore.Read("Creds[0].Username"));
            Assert.Equal("pass1", configStore.Read("Creds[0].Password"));
            Assert.Equal("user2", configStore.Read("Creds[1].Username"));
            Assert.Equal("pass2", configStore.Read("Creds[1].Password"));;
        }
Exemplo n.º 2
0
        public void Build_DebugEnvVarFileExist_DebugOverrideConfigStore()
        {
            Environment.SetEnvironmentVariable(EnvironmentFileBuilder.EnvironmentKey, "Debug");
            IConfigStore configStore = new EnvironmentFileBuilder().Build(_path);

            Assert.True(bool.Parse(configStore.Read("Logging.IncludeScopes")));

            Assert.Equal("Debug", configStore.Read("Logging.LogLevel.Default"));
            Assert.Equal("Information", configStore.Read("Logging.LogLevel.System"));
            Assert.Equal("Debug", configStore.Read("Logging.LogLevel.Microsoft"));

            Assert.Equal("debug-key", configStore.Read("ApplicationInsights.InstrumentationKey"));

            Assert.Equal("1", configStore.Read("Numbers[0]"));
            Assert.Equal("0", configStore.Read("Numbers[1]"));
            Assert.Equal("3", configStore.Read("Numbers[2]"));

            Assert.Equal("user1", configStore.Read("Creds[0].Username"));
            Assert.Equal("pass1", configStore.Read("Creds[0].Password"));
            Assert.Equal("user2", configStore.Read("Creds[1].Username"));
            Assert.Equal("debug", configStore.Read("Creds[1].Password"));
        }
Exemplo n.º 3
0
        public void Build_NoEnvVarNoFile_EmptyConfigStore()
        {
            IConfigStore configStore = new EnvironmentFileBuilder().Build(_path + "x");

            Assert.Null(configStore.Read("ApplicationInsights.InstrumentationKey"));
        }