public override bool Execute()
        {
            Logger.LogAction = (msg, level) =>
            {
                if (level == LogLevel.Error)
                {
                    Log.LogError(msg);
                }
                if (level == LogLevel.Warning)
                {
                    Log.LogWarning(msg);
                }
                if (level == LogLevel.Debug)
                {
                    Log.LogMessage(MessageImportance.High, msg);
                }
            };

            var config = GeneratorConfiguration.FromFile(ConfigFile);

            config.ApplyProperties(InlineProperties.Parse(Properties));
            ConfigGenerator.ForAllSets(config);

            return(true);
        }
Exemplo n.º 2
0
        public void ProjectConfigsWithParamsTest()
        {
            string valuesDir   = Path.Combine(TestUtils.DataDir, "configs");
            string templateDir = Path.Combine(TestUtils.DataDir, "templates", "app1");

            ConfigGenerator.ForAllSets(valuesDir, templateDir, TestUtils.OutputDir, templateOutputSubdir: "myconfigs", cleanOutputDir: true, debug: false, parameters: "Param1=value1;Test=testvalue");

            string app1Path = Path.Combine(TestUtils.OutputDir, @"project1\configuration1\myconfigs");

            Assert.AreEqual(true, Directory.Exists(app1Path));
            string text1 = File.ReadAllText(Path.Combine(app1Path, "web.config")).Trim();

            Assert.AreEqual("app1=testvaluetestvalue", text1);
            string text2 = File.ReadAllText(Path.Combine(app1Path, @"subapp1\web.config")).Trim();

            Assert.AreEqual("subapp1=testvalue", text2);
        }