public void should_not_store_or_return_variables_for_other_environments()
        {
            // given
            const string name = "variables-are-super-awesome";

            _sharedVariablesProvider.ListSharedVariables_Value = new IVariable[]
            {
                new Variable(name, "not this value", string.Empty),
                new Variable(name, "nearly expected value", "what environment?"),
                new Variable(name, "nearly expected value", "another environment"),
            };

            var variableContainer = new VariableContainer("env", _reservedVariableProvider, _sharedVariablesProvider);
            var anotherVariable   = new Variable(name, "expected value", "doobee");

            variableContainer.Add(anotherVariable);

            // when
            List <IVariable> variables = variableContainer.ToList();

            // then
            Assert.That(variables.Any(x => x == anotherVariable), Is.False);
            Assert.That(variables.Any(x => x == _sharedVariablesProvider.ListSharedVariables_Value[0]), Is.True);
            Assert.That(variables.Any(x => x == _sharedVariablesProvider.ListSharedVariables_Value[1]), Is.False);
            Assert.That(variables.Any(x => x == _sharedVariablesProvider.ListSharedVariables_Value[2]), Is.False);
        }
        public void should_prioritise_custom_variable_over_other_variables()
        {
            // given
            const string name        = "variables-are-super-awesome";
            const string environment = "my-env";

            _sharedVariablesProvider.ListSharedVariables_Value = new IVariable[]
            {
                new Variable("another-thing", "NOT ME", "something else"),
                new Variable(name, "NOT ME", "something else"),
                new Variable(name, "NOT ME", "another one"),
                new Variable(name, "NOT ME", environment),
                new Variable(name, string.Empty, environment),
                new Variable("HELLO", "NOT ME", "CARS"),
            };

            var variableContainer = new VariableContainer(environment, _reservedVariableProvider, _sharedVariablesProvider);
            var expectedVariable  = new Variable(name, "expected value", environment);

            variableContainer.Add(expectedVariable);

            // when
            List <IVariable> variables = variableContainer.ToList();
            IVariable        result    = variables.First(x => x.Name == name && x.Environment.Name == environment);

            // then
            Assert.That(result, Is.EqualTo(expectedVariable));
        }
        public void should_return_a_scoped_shared_variable_over_default_value()
        {
            // given
            const string name        = "variables-are-super-awesome";
            const string environment = "my-env";

            var expectedVariable = new Variable(name, "nearly expected value", environment);

            _sharedVariablesProvider.ListSharedVariables_Value = new IVariable[]
            {
                new Variable(name, "not this value", string.Empty),
                expectedVariable
            };

            var variableContainer = new VariableContainer(environment, _reservedVariableProvider, _sharedVariablesProvider);

            variableContainer.Add(new Variable(name, "not me either", string.Empty));

            // when
            List <IVariable> variables = variableContainer.ToList();
            IVariable        result    = variables.First(x => x.Name == name && x.Environment.Name == environment);

            // then
            Assert.That(result, Is.EqualTo(expectedVariable));
        }