public void DoesntGetNonExistingEnvironmentVariable() { var key = Guid.NewGuid().ToString(); var sut = new EnvironmentSettingsSource(); string value; var found = sut.TryGetRawSetting(key, out value); Assert.False(found, "Strangely, a randomly generated key was found"); }
public void GetsExistingEnvironmentVariable() { var key = Guid.NewGuid().ToString(); Environment.SetEnvironmentVariable(key, "this is a test"); var sut = new EnvironmentSettingsSource(); string value; var found = sut.TryGetRawSetting(key, out value); Assert.True(found, "Randomly generated key was not found"); Assert.Equal("this is a test", value); }
public MultipleSettingsSourceTests() { Environment.SetEnvironmentVariable("EnvironmentKey", "Environment value"); Environment.SetEnvironmentVariable("CommonKey", "Environment value for common key"); var environmentSettingsSource = new EnvironmentSettingsSource(); var inMemorySettingsSource = new InMemorySettingsSource( new Dictionary <string, string> { { "InMemoryKey", "In memory value" }, { "CommonKey", "In memory value for common key" } }); sut = new MultipleSettingsSource(new List <IRawSettingsSource> { environmentSettingsSource, inMemorySettingsSource }); }