Exemplo n.º 1
0
        static void Main(string[] args)
        {
            if (args.Length != 4)
            {
                System.Console.WriteLine();
                System.Console.WriteLine("DeploymentHelper. Replaces strings in your app configuration file(s) with data read from an Excel file.");
                System.Console.WriteLine("Usage: DeploymentHelper.exe ExcelFile Environment InputFile OutputFile");
                System.Console.WriteLine();
                return;
            }

            // Arg 1 is the excel file
            var excelFile = args[0];

            // Arg 2 is the environment
            var environment = args[1];

            // Arg 3 is the input file
            var inputFile = args[2];

            // Arg 4 is the output file
            var outputFile = args[3];

            try
            {
                var deploy = new Core.DeploymentHelper(excelFile, environment);
                deploy.ParseFile(inputFile, outputFile);
            }
            catch (InvalidOperationException ex)
            {
                if (!ex.Message.Contains("Microsoft.ACE.OLEDB")) throw;

                System.Console.WriteLine("The Microsoft Database Engine is missing from this machine. You can download it from the Microsoft Download Center: http://www.microsoft.com/download/details.aspx?id=13255");
            }
        }
Exemplo n.º 2
0
        public void TestMethod1()
        {
            // Init
            var deploy = new Core.DeploymentHelper(ExcelFile, "Dev");

            // Test actual operation
            deploy.ParseFile(InputFile, OutputFile);

            // Test output file
            var fileContent = File.ReadAllText(OutputFile);

            Assert.IsFalse(fileContent.Contains("{{Pi.Server}}"));
            Assert.IsTrue(fileContent.Contains("Data Source=pidev;"));
            Assert.IsTrue(fileContent.Contains("value=\"http://\""));
        }