//--------------------------------------------------------------------- // internal for testing internal async Task Convert(string trxFile, string outputPath = null) { string jUnitFile = GetJunitFile(trxFile, outputPath); EnsureOutputDirectoryExists(jUnitFile); Console.WriteLine($"Converting '{trxFile}' to '{jUnitFile}'"); using (Stream input = File.OpenRead(trxFile)) using (TextWriter output = new StreamWriter(jUnitFile, false, s_utf8)) { var converter = new Trx2JunitConverter(); await converter.Convert(input, output); } }
//--------------------------------------------------------------------- private static async Task RunAsync(string[] args) { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; string trxFile = args[0]; string jUnitFile = Path.ChangeExtension(trxFile, "xml"); Console.WriteLine($"Converting trx-file '{trxFile}' to JUnit-xml..."); DateTime start = DateTime.Now; var utf8 = new UTF8Encoding(false); using (Stream input = File.OpenRead(trxFile)) using (TextWriter output = new StreamWriter(jUnitFile, false, utf8)) { var converter = new Trx2JunitConverter(); await converter.Convert(input, output); } Console.WriteLine($"done in {(DateTime.Now - start).TotalSeconds} seconds. bye."); }