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); } }
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); } }
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); } }
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); } }