Exemple #1
0
        private IEnumerable <string> InterpolateResources(wigc.Pipeline p, wigc.Job j)
        {
            var dict = ParametersOf(p);
            var ip   = new ParameterInterpolator(dict);

            return(j
                   .Resources
                   .Resource
                   .Select(ip.Substitute)
                   );
        }
Exemple #2
0
        public void ReplacingParametersInStrings()
        {
            "GoCD replaces tokens in configuration strings"
            .x(() => {
                var dict = new Dictionary <string, string> {
                    { "unit", "42" },
                    { "unit_resource", "my_resource" },
                    { "#{unit_resource}", "x" },
                };

                var ip = new ParameterInterpolator(dict);
                ip.Substitute("unit").Should().Be("unit");
                ip.Substitute("#{unit_resource}").Should().Be("my_resource");
                ip.Substitute("unit_resource").Should().Be("unit_resource");

                // spaces not allowed (yet)
                ip.Substitute("#{unit_resource} ").Should().Be("#{unit_resource} ");
            });
        }