public void DoesntGetNonExistingEnvironmentVariable() { var sut = new InMemorySettingsSource(settings); string value; var found = sut.TryGetRawSetting("ThisKeyDoesNotExist", out value); Assert.False(found, "Strangely, a non existing key was found"); }
public void GetsExistingEnvironmentVariable() { var sut = new InMemorySettingsSource(settings); string value; var found = sut.TryGetRawSetting("SomeKey", out value); Assert.True(found, "SomeKey was not found"); Assert.Equal("Some value", 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 }); }
/// <summary> /// Initializes a new instance of the <see cref="TestTokenReplacementSettingSource"/> class. /// </summary> public TestTokenReplacementSettingSource() { this.wrappedSource = new InMemorySettingsSource(); this.source = new TokenReplacementSettingsSource("__", this.wrappedSource); }