Exemple #1
0
        public void Test(string folder, bool isToTranslate, bool useSpecialFileCompare)
        {
            GetPaths(folder);

            LogInfo("OutputTest Project " + folder);

            LogInfo("\tProjectFileName " + ProjectFileName);
            LogInfo("\tProjectFolder " + ProjectFolder);

            LogInfo("\tProjectFilePath " + ProjectFilePath);

            LogInfo("\tOutputFolder " + OutputFolder);
            LogInfo("\tReferenceFolder " + ReferenceFolder);

            var translator = new TranslatorRunner()
            {
                ProjectLocation = ProjectFilePath,
                BuildArguments  = OutputTest.BuildArguments
            };

            try
            {
                if (isToTranslate)
                {
                    translator.Translate();
                }
                else
                {
                    translator.Build();
                }
            }
            catch (Exception ex)
            {
                Assert.Fail("Could not {0} the project {1}. Exception occurred: {2}.", isToTranslate ? "translate" : "build", folder, ex.Message);
            }

            try
            {
                var comparence = FolderComparer.CompareFolders(this.ReferenceFolder, this.OutputFolder, useSpecialFileCompare ? SpecialFiles : null);

                if (comparence.Any())
                {
                    var sb = new StringBuilder();

                    foreach (var diff in comparence)
                    {
                        sb.AppendLine(diff.ToString());
                    }

                    FolderComparer.LogDifferences("Project " + folder + " differences:", comparence);

                    Assert.Fail(sb.ToString());
                }
            }
            catch (Exception ex)
            {
                Assert.Fail("Could not compare the project {0} output. Exception occurred: {1}.", folder, ex.Message);
            }
        }
        private void TranslateTestProject(bool isToBuild, Logger logger)
        {
            var translator = new TranslatorRunner()
            {
                Logger          = logger,
                ProjectLocation = ProjectFilePath,
                BuildArguments  = IntegrationTest.BuildArguments
            };

            if (isToBuild)
            {
                translator.Translate(true);
            }
            else
            {
                translator.Translate(false);
            }
        }
Exemple #3
0
        private void TranslateTestProject(bool isToTranslate, Logger logger)
        {
            var translator = new TranslatorRunner()
            {
                Logger          = logger,
                ProjectLocation = ProjectFilePath,
                BuildArguments  = OutputTest.BuildArguments
            };

            if (isToTranslate)
            {
                translator.Translate();
            }
            else
            {
                translator.Translate(true);
            }
        }
Exemple #4
0
        public void Test(string folder, bool isToTranslate, bool useSpecialFileCompare)
        {
            var logDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            var logger = new Logger("Bridge.Test.Runner", true, new SimpleFileLoggerWriter(logDir), new ConsoleLoggerWriter());

            GetPaths(folder);

            logger.Info("OutputTest Project " + folder);

            logger.Info("\tProjectFileName " + ProjectFileName);
            logger.Info("\tProjectFolder " + ProjectFolder);

            logger.Info("\tProjectFilePath " + ProjectFilePath);

            logger.Info("\tOutputFolder " + OutputFolder);
            logger.Info("\tReferenceFolder " + ReferenceFolder);

            var translator = new TranslatorRunner()
            {
                Logger = logger,
                ProjectLocation = ProjectFilePath,
                BuildArguments = OutputTest.BuildArguments
            };

            try
            {
                if (isToTranslate)
                {
                    translator.Translate();
                }
                else
                {
                    translator.Build();
                }
            }
            catch (Exception ex)
            {
                Assert.Fail("Could not {0} the project {1}. Exception occurred: {2}.", isToTranslate ? "translate" : "build", folder, ex.Message);
            }

            try
            {
                var folderComparer = new FolderComparer() { Logger = logger };

                var comparence = folderComparer.CompareFolders(this.ReferenceFolder, this.OutputFolder, useSpecialFileCompare ? SpecialFiles : null);

                if (comparence.Any())
                {
                    var sb = new StringBuilder();

                    foreach (var diff in comparence)
                    {
                        sb.AppendLine(diff.ToString());
                    }

                    folderComparer.LogDifferences("Project " + folder + " differences:", comparence);

                    Assert.Fail(sb.ToString());
                }
            }
            catch (Exception ex)
            {
                var message = string.Format("Could not compare the project {0} output. Exception occurred: {1}.", folder, ex.Message);

                logger.Error(message);
                Assert.Fail(message);
            }
        }
Exemple #5
0
        public void Test(string folder, bool isToTranslate, bool useSpecialFileCompare)
        {
            GetPaths(folder);

            LogInfo("OutputTest Project " + folder);

            LogInfo("\tProjectFileName " + ProjectFileName);
            LogInfo("\tProjectFolder " + ProjectFolder);

            LogInfo("\tProjectFilePath " + ProjectFilePath);

            LogInfo("\tOutputFolder " + OutputFolder);
            LogInfo("\tReferenceFolder " + ReferenceFolder);

            var translator = new TranslatorRunner()
            {
                ProjectLocation = ProjectFilePath,
                BuildArguments = OutputTest.BuildArguments
            };

            try
            {
                if (isToTranslate)
                {
                    translator.Translate();
                }
                else
                {
                    translator.Build();
                }
            }
            catch (Exception ex)
            {
                Assert.Fail("Could not {0} the project {1}. Exception occurred: {2}.", isToTranslate ? "translate" : "build", folder, ex.Message);
            }

            try
            {
                var comparence = FolderComparer.CompareFolders(this.ReferenceFolder, this.OutputFolder, useSpecialFileCompare ? SpecialFiles : null);

                if (comparence.Any())
                {
                    var sb = new StringBuilder();
                    foreach (var diff in comparence)
                    {
                        sb.AppendLine(diff.ToString());
                    }

                    FolderComparer.LogDifferences("Project " + folder + " differences:", comparence);

                    Assert.Fail(sb.ToString());
                }
            }
            catch (Exception ex)
            {
                Assert.Fail("Could not compare the project {0} output. Exception occurred: {1}.", folder, ex.Message);
            }
        }
Exemple #6
0
        public void Test(string folder, bool isToTranslate, bool useSpecialFileCompare)
        {
            var logger = new Logger("Bridge.Test.Runner", true, SimpleFileLoggerWriter.Instance, new ConsoleLoggerWriter());

            GetPaths(folder);

            logger.Info("OutputTest Project " + folder);

            logger.Info("\tProjectFileName " + ProjectFileName);
            logger.Info("\tProjectFolder " + ProjectFolder);

            logger.Info("\tProjectFilePath " + ProjectFilePath);

            logger.Info("\tOutputFolder " + OutputFolder);
            logger.Info("\tReferenceFolder " + ReferenceFolder);

            var translator = new TranslatorRunner()
            {
                Logger          = logger,
                ProjectLocation = ProjectFilePath,
                BuildArguments  = OutputTest.BuildArguments
            };

            try
            {
                if (isToTranslate)
                {
                    translator.Translate();
                }
                else
                {
                    translator.Build();
                }
            }
            catch (Exception ex)
            {
                Assert.Fail("Could not {0} the project {1}. Exception occurred: {2}.", isToTranslate ? "translate" : "build", folder, ex.Message);
            }

            try
            {
                var folderComparer = new FolderComparer()
                {
                    Logger = logger
                };

                var comparence = folderComparer.CompareFolders(this.ReferenceFolder, this.OutputFolder, useSpecialFileCompare ? SpecialFiles : null);

                if (comparence.Any())
                {
                    var sb = new StringBuilder();

                    foreach (var diff in comparence)
                    {
                        sb.AppendLine(diff.ToString());
                    }

                    folderComparer.LogDifferences("Project " + folder + " differences:", comparence);

                    Assert.Fail(sb.ToString());
                }
            }
            catch (Exception ex)
            {
                var message = string.Format("Could not compare the project {0} output. Exception occurred: {1}.", folder, ex.Message);

                logger.Error(message);
                Assert.Fail(message);
            }
        }