public async Task EnvironmentVariables_OnSetPropertyValueAsync_HandlesEscapeCharactersProperly() { var activeProfileEnvironmentVariables = new Dictionary <string, string> { { "Alpha", "one" } }; ImmutableDictionary <string, string>?updatedEnvironmentVariables = null; var settingsProvider = SetupLaunchSettingsProvider( activeProfileName: "One", activeProfileEnvironmentVariables: activeProfileEnvironmentVariables, updateLaunchSettingsCallback: s => { Assumes.NotNull(s.ActiveProfile?.EnvironmentVariables); updatedEnvironmentVariables = s.ActiveProfile?.EnvironmentVariables; }); var project = UnconfiguredProjectFactory.Create(); var threadingService = IProjectThreadingServiceFactory.Create(); var provider = new ActiveLaunchProfileEnvironmentVariableValueProvider(settingsProvider); await provider.OnSetPropertyValueAsync(ActiveLaunchProfileEnvironmentVariableValueProvider.EnvironmentVariablesPropertyName, "Alpha=Equals: /= Comma: /, Slash: //,Beta=two", Mock.Of <IProjectProperties>()); Assumes.NotNull(updatedEnvironmentVariables); Assert.Equal(expected: "Equals: = Comma: , Slash: /", actual: updatedEnvironmentVariables["Alpha"]); Assert.Equal(expected: "two", actual: updatedEnvironmentVariables["Beta"]); }
public async Task EnvironmentVariables_OnGetPropertyValueAsync_GetsEscapedValuesFromActiveProfile() { var activeProfileEnvironmentVariables = new Dictionary <string, string> { { "Alpha", "Comma: , Equals: =" }, { "Beta", "12345" } }; var settingsProvider = SetupLaunchSettingsProvider(activeProfileName: "One", activeProfileEnvironmentVariables: activeProfileEnvironmentVariables); var provider = new ActiveLaunchProfileEnvironmentVariableValueProvider(settingsProvider); var actualValue = await provider.OnGetEvaluatedPropertyValueAsync(ActiveLaunchProfileEnvironmentVariableValueProvider.EnvironmentVariablesPropertyName, string.Empty, Mock.Of <IProjectProperties>()); Assert.Equal(expected: "Alpha=Comma: /, Equals: /=,Beta=12345", actual: actualValue); }
public async Task EnvironmentVariables_OnGetPropertyValueAsync_VariablesAreSorted() { var activeProfileEnvironmentVariables = new Dictionary <string, string> { { "var3", "value3" }, { "var2", "value2" }, { "var1", "value1" } }; var settingsProvider = SetupLaunchSettingsProvider(activeProfileName: "One", activeProfileEnvironmentVariables: activeProfileEnvironmentVariables); var provider = new ActiveLaunchProfileEnvironmentVariableValueProvider(settingsProvider); var actualValue = await provider.OnGetEvaluatedPropertyValueAsync(ActiveLaunchProfileEnvironmentVariableValueProvider.EnvironmentVariablesPropertyName, string.Empty, Mock.Of <IProjectProperties>()); Assert.Equal(expected: "var1=value1,var2=value2,var3=value3", actual: actualValue); }