public void Loads_DotEnv_File_Variables() { this.LoadEnvironmentVariables(); EnvFileVariable.Should().Be("This is an environment variable value"); OtherEnvFileVariable.Should().Be("ThisIsAnotherVariable"); EnvFileVarWithSpaces.Should().Be("This is a spaced environment variable"); }
public void Does_Not_Load_Env_File_If_Not_Exists() { File.Copy(".env", "copy.env"); File.Delete(".env"); this.LoadEnvironmentVariables(); EnvFileVariable.Should().BeNull(); OtherEnvFileVariable.Should().BeNull(); EnvFileVarWithSpaces.Should().BeNull(); File.Move("copy.env", ".env"); }
public void Does_Not_Override_Existing_Environment_Variables_With_DotEnv_Variables() { const string expectedValue1 = "expected value 1"; const string expectedValue2 = "expected value 2"; Environment.SetEnvironmentVariable("EnvFileVariable", expectedValue1); Environment.SetEnvironmentVariable("OTHER_ENV_FILE_VARIABLE", expectedValue2); this.LoadEnvironmentVariables(); EnvFileVariable.Should().Be(expectedValue1); OtherEnvFileVariable.Should().Be(expectedValue2); EnvFileVarWithSpaces.Should().Be("This is a spaced environment variable"); }