public void Should_Return_Default_Bool_Value_True_If_Not_Found() { var variables = new Dictionary <string, string>() { }; var target = new CaseInsensitiveEnvironmentVariables(variables); var actual = target.GetEnvVar("MYVAR", true); Assert.True(actual); }
public void Should_Return_Null_If_Not_Found() { var variables = new Dictionary <string, string>() { }; var target = new CaseInsensitiveEnvironmentVariables(variables); var actual = target.GetEnvVar("NOT_EXISTS", null); Assert.Null(actual); }
public void Should_Find_Uint_If_Case_Does_Not_Match() { var variables = new Dictionary <string, string>() { { "myvar", "8931" } }; var target = new CaseInsensitiveEnvironmentVariables(variables); var actual = target.GetEnvVar("MYVAR", 0u); Assert.Equal(8931u, actual); }
public void Should_Return_Default_Uint_Value_If_Cannot_Parse() { var variables = new Dictionary <string, string>() { { "MYVAR", "ABC" } }; var target = new CaseInsensitiveEnvironmentVariables(variables); var actual = target.GetEnvVar("MYVAR", 12u); Assert.Equal(12u, actual); }
public void Should_Return_StringEmpty_If_Not_Found() { var variables = new Dictionary <string, string>() { }; var target = new CaseInsensitiveEnvironmentVariables(variables); var actual = target.GetEnvVar("NOT_EXISTS", string.Empty); Assert.NotNull(actual); Assert.Equal(0, actual.Length); }
public void Should_Find_Int_If_Case_Matches() { var variables = new Dictionary <string, string>() { { "MYVAR", "20" } }; var target = new CaseInsensitiveEnvironmentVariables(variables); var actual = target.GetEnvVar("MYVAR", 0); Assert.Equal(20, actual); }
public void Should_Find_Bool_If_Case_Does_Not_Match() { var variables = new Dictionary <string, string>() { { "myvar", "true" } }; var target = new CaseInsensitiveEnvironmentVariables(variables); var actual = target.GetEnvVar("MYVAR", false); Assert.True(actual); }
public void Should_Find_String_If_Case_Does_Not_Match() { var variables = new Dictionary <string, string>() { { "myvar", "VALUE" } }; var target = new CaseInsensitiveEnvironmentVariables(variables); var actual = target.GetEnvVar("MYVAR", string.Empty); Assert.NotNull(actual); Assert.Equal("VALUE", actual); }