private async Task WriteResult(ResultSummary testResult) { using (var tcpWriter = new TcpWriter(Options.TcpWriterParameters)) { await tcpWriter.Connect().ConfigureAwait(false); tcpWriter.Write(testResult.GetTestXml()); } }
void WriteXmlResultFile(ResultSummary result) { var outputFolderName = Path.GetDirectoryName(Options.ResultFilePath); Directory.CreateDirectory(outputFolderName); var xml = result.GetTestXml().ToString(); File.WriteAllText(Options.ResultFilePath, xml); }
async Task WriteXmlResultFile(ResultSummary result) { string outputFolderName = Path.GetDirectoryName(Options.ResultFilePath); Directory.CreateDirectory(outputFolderName); using (var resultFileStream = new StreamWriter(Options.ResultFilePath, false)) { var xml = result.GetTestXml().ToString(); await resultFileStream.WriteAsync(xml); } }
async Task WriteXmlResultFile(ResultSummary result) { string outputFolderName = Path.GetDirectoryName(Options.ResultFilePath); string outputXmlReportName = Path.GetFileName(Options.ResultFilePath); await CreateFolderRecursive(outputFolderName); IFolder outputFolder = await FileSystem.Current.GetFolderFromPathAsync(outputFolderName, CancellationToken.None); IFile xmlResultFile = await outputFolder.CreateFileAsync(outputXmlReportName, CreationCollisionOption.ReplaceExisting); using (var resultFileStream = new StreamWriter(await xmlResultFile.OpenAsync(FileAccess.ReadAndWrite))) { var xml = result.GetTestXml().ToString(); await resultFileStream.WriteAsync(xml); } }