public void AddOrUpdateVariables_should_set_variable()
        {
            // 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)
            });


            // then
            Assert.That(sessionVariables.GetVariableValue("nano"), Is.EqualTo("leaf"));
            Assert.That(sessionVariables.GetVariableValue("light"), Is.EqualTo("bulb"));
        }
        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"));
        }
        public void AddOrUpdateVariable_should_not_set_variable_when_in_different_environments()
        {
            // given
            var sessionVariables = new CapturedVariableProvider(_variableContainer, _devEnvironment, new VariableEncryptorStub());
            var variable         = new Variable("nano", "leaf", _prodEnvironment);

            // when
            sessionVariables.AddOrUpdateVariable(variable);

            // then
            Assert.That(sessionVariables.GetVariableValue("nano"), Is.EqualTo(string.Empty));
        }
        public void AddOrUpdateVariable_should_set_variable()
        {
            // given
            var sessionVariables = new CapturedVariableProvider(_variableContainer, _devEnvironment, new VariableEncryptorStub());
            var variable         = new Variable("nano", "leaf", _devEnvironment);

            // whenS
            sessionVariables.AddOrUpdateVariable(variable);

            // then
            Assert.That(sessionVariables.GetVariableValue("nano"), Is.EqualTo("leaf"));
        }