private static void WriteTest(this Utf8JsonWriter jsonTextWriter, TestResult test) { jsonTextWriter.WriteStartObject(); jsonTextWriter.WriteName(test.Name); jsonTextWriter.WriteStatus(test.Status); jsonTextWriter.WriteMessage(test.Message); jsonTextWriter.WriteOutput(test.Output); jsonTextWriter.WriteEndObject(); }
public static void WriteToFile(Options options, TestRun solutionAnalysis) { var filePath = GetResultsFilePath(options); using var fileStream = File.Create(filePath); using var jsonTextWriter = new Utf8JsonWriter(fileStream, new JsonWriterOptions { Indented = true }); jsonTextWriter.WriteStartObject(); jsonTextWriter.WriteStatus(solutionAnalysis.Status); jsonTextWriter.WriteMessage(solutionAnalysis.Message); jsonTextWriter.WriteTests(solutionAnalysis.Tests); jsonTextWriter.WriteEndObject(); jsonTextWriter.Flush(); }