public void RegisterCommandT_ShouldNotReadFlagEnvironmentVariable_IfSetAfterInitialization() { var testConfig = new TestConfig(); NonLazyConfigPathArgumentsType commandArgs = null; Cli .Configure(c => c .SetDialect(Dialect.Gnu) .SetConfiguration(testConfig) ) .Root <NonLazyConfigPathArgumentsType>(c => c .SetExecute((args, output) => { commandArgs = args; }) ) .Run(new string[0]); testConfig .SetConfigValue("NFLAG_TEST_FLAG1", "false"); Assert.True(commandArgs.Flag); }
public void RegisterCommandT_ShouldNotReadParameterEnvironmentVariable_IfSetAfterInitialization() { var testConfig = new TestConfig(); NonLazyConfigPathArgumentsType commandArgs = null; Cli .Configure(c => c .SetDialect(Dialect.Gnu) .SetConfiguration(testConfig) ) .Root <NonLazyConfigPathArgumentsType>(c => c .SetExecute((args, output) => { commandArgs = args; }) ) .Run(new string[0]); testConfig .SetConfigValue("config.parameter", "env_p"); Assert.Equal("def_p", commandArgs.Parameter); }