示例#1
0
        public void NonExistentValueWithNullDefaultValueTest()
        {
            var c     = new TestCakeContext();
            var value = TfsBuildVariablesAliases.EvaluateTfsBuildVariable(c, "Cake.Variables.Test", null);

            Assert.Null(value);
        }
示例#2
0
        public void NonExistentValueWithDefaultValueTest()
        {
            var c     = new TestCakeContext();
            var value = TfsBuildVariablesAliases.EvaluateTfsBuildVariable(c, "Cake.Variables.Test", "defval");

            Assert.Equal("defval", value);
        }
示例#3
0
 public void NonExistentValueTest()
 {
     try
     {
         var c = new TestCakeContext();
         TfsBuildVariablesAliases.EvaluateTfsBuildVariable(c, "Cake.Variables.Test");
         Assert.True(false);
     }
     catch (ArgumentException)
     {
         Assert.True(true);
     }
 }
示例#4
0
        public void ValueFromArgTest()
        {
            Dictionary <string, string> envVars = new Dictionary <string, string>();
            Dictionary <string, string> args    = new Dictionary <string, string>()
            {
                { "Cake.Variables.Test", "testargvalue" }
            };

            var c     = new TestCakeContext(envVars, args);
            var value = TfsBuildVariablesAliases.EvaluateTfsBuildVariable(c, "Cake.Variables.Test");

            Assert.Equal("testargvalue", value);
        }
示例#5
0
        public void ChainedValueTest()
        {
            Dictionary <string, string> envVars = new Dictionary <string, string>()
            {
                { "CAKE_VARIABLES_TEST", "Test value: $(Cake.Variables.MoreTest)." }, { "CAKE_VARIABLES_MORETEST", "12345" }
            };
            Dictionary <string, string> args = new Dictionary <string, string>();

            var c     = new TestCakeContext(envVars, args);
            var value = TfsBuildVariablesAliases.EvaluateTfsBuildVariable(c, "Cake.Variables.Test");

            Assert.Equal("Test value: 12345.", value);
        }
示例#6
0
        public void ValueFromEnvAndArgWithDefaultValueTest()
        {
            Dictionary <string, string> envVars = new Dictionary <string, string>()
            {
                { "CAKE_VARIABLES_TEST", "testenvvalue" }
            };
            Dictionary <string, string> args = new Dictionary <string, string>()
            {
                { "Cake.Variables.Test", "testargvalue" }
            };

            var c     = new TestCakeContext(envVars, args);
            var value = TfsBuildVariablesAliases.EvaluateTfsBuildVariable(c, "Cake.Variables.Test", "defval");

            Assert.Equal("testargvalue", value);
        }