public void AddOrUpdateVariables_should_update_variable_when_both_existing_and_new_variable_have_environment_set() { // given var sessionVariables = new CapturedVariableProvider(_variableContainer, _devEnvironment, new VariableEncryptorStub()); // when sessionVariables.AddOrUpdateVariables(new List <Variable>() { new Variable("nano", "leaf", _devEnvironment), new Variable("light", "bulb", _devEnvironment), }); sessionVariables.AddOrUpdateVariables(new List <Variable>() { new Variable("nano", "leaf2", _devEnvironment), new Variable("light", "bulb2", _devEnvironment) }); // then Assert.That(sessionVariables.GetVariableValue("nano"), Is.EqualTo("leaf2")); Assert.That(sessionVariables.GetVariableValue("light"), Is.EqualTo("bulb2")); }
public void AddOrUpdateVariables_should_not_update_variable_when_setting_as_default_and_has_existing_variable_set_against_a_specific_environment() { // given var sessionVariables = new CapturedVariableProvider(_variableContainer, _devEnvironment, new VariableEncryptorStub()); // when sessionVariables.AddOrUpdateVariables(new List <Variable>() { new Variable("nano", "leaf", _devEnvironment), new Variable("light", "bulb", _devEnvironment), }); sessionVariables.AddOrUpdateVariables(new List <Variable>() { new Variable("nano", "leaf2", string.Empty), new Variable("light", "bulb2", string.Empty) }); // then Assert.That(sessionVariables.GetVariableValue("nano"), Is.EqualTo("leaf")); Assert.That(sessionVariables.GetVariableValue("light"), Is.EqualTo("bulb")); }