Exemplo n.º 1
0
 public void Should_expand_process_environment_variable()
 {
     // Use environment variables with angle brackets to reduce liklihood of affecting
     // the environment variables that could be used elsewhere.
     try
     {
         Environment.SetEnvironmentVariable("<test-process>", "test-process", EnvironmentVariableTarget.Process);
         Assert.That(EnvironmentVariables.Expand("${<test-process>}"), Is.EqualTo("test-process"));
     }
     finally
     {
         Environment.SetEnvironmentVariable("<test-process>", null, EnvironmentVariableTarget.Process);
     }
 }
Exemplo n.º 2
0
 public void Should_retain_original_input_if_variable_is_not_found()
 {
     Assert.That(EnvironmentVariables.Expand("${should not find me}"), Is.EqualTo("${should not find me}"));
 }
Exemplo n.º 3
0
 public void Should_be_case_insensitive()
 {
     Assert.That(EnvironmentVariables.Expand("${temp}"), Is.EqualTo(Temp));
 }
Exemplo n.º 4
0
 public void Should_expand_multiple_variables()
 {
     Assert.That(EnvironmentVariables.Expand("${cd}-${cd}"), Is.EqualTo(Cd + "-" + Cd));
 }
Exemplo n.º 5
0
 public void Should_expand_app_config_variable()
 {
     Assert.That(EnvironmentVariables.Expand("${test-app-config}"), Is.EqualTo(new AppSettingsReader().GetValue("test-app-config", typeof(string))));
 }
Exemplo n.º 6
0
 public void Should_expand_machine_environment_variable()
 {
     Assert.That(EnvironmentVariables.Expand("${OS}"), Is.EqualTo(Environment.GetEnvironmentVariable("OS", EnvironmentVariableTarget.Machine)));
 }
Exemplo n.º 7
0
 public void Should_expand_user_environment_variable()
 {
     Assert.That(EnvironmentVariables.Expand("${Temp}"), Is.EqualTo(Temp));
 }
Exemplo n.º 8
0
 public void Should_expand_CD_with_current_directory()
 {
     Assert.That(EnvironmentVariables.Expand("${CD}"), Is.EqualTo(Cd));
 }