Exemple #1
0
        public void TryToGetUnsafedVariable()
        {
            var storage = new LocalVariablesStorage();
            var varName = "someVar";

            Assert.AreEqual(String.Empty, storage.Get(varName));
        }
Exemple #2
0
        public void AddAndGetTest()
        {
            var storage  = new LocalVariablesStorage();
            var varName  = "someVar";
            var varValue = "someValue";

            Assert.DoesNotThrow(() => storage.Add(varName, varValue, false));
            Assert.AreEqual(varValue, storage.Get(varName));
        }
        public string GetVariable(string name)
        {
            var variable = Environment.GetEnvironmentVariable(name);

            if (variable == null)
            {
                variable = storage.Get(name);
            }

            return(variable);
        }
Exemple #4
0
        public void ChangeVariabeValue()
        {
            var storage        = new LocalVariablesStorage();
            var varName        = "someConstVar";
            var varValue       = "someConstValue";
            var secondVarValue = "someNewValue";

            Assert.DoesNotThrow(() => storage.Add(varName, varValue, false));
            Assert.DoesNotThrow(() => storage.Add(varName, secondVarValue, false));
            Assert.AreEqual(secondVarValue, storage.Get(varName));
        }