<PackageReference Include="NUnit" Version="4.2.1" />

TestMessage

public sealed class TestMessage
The TestMessage class holds a message sent by a test to all listeners
using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; using System.Xml; namespace NUnit.Framework.Interfaces { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] [DebuggerDisplay("{ToString(),nq}")] public sealed class TestMessage { public string Message { get; } public string Destination { get; } [System.Runtime.CompilerServices.Nullable(2)] [field: System.Runtime.CompilerServices.Nullable(2)] public string TestId { [System.Runtime.CompilerServices.NullableContext(2)] get; } public TestMessage(string destination, string text, [System.Runtime.CompilerServices.Nullable(2)] string testId) { Guard.ArgumentNotNull(destination, "destination"); Guard.ArgumentNotNull(text, "text"); Destination = destination; Message = text; TestId = testId; } public override string ToString() { return Destination + ": " + Message; } public string ToXml() { using (StringWriter stringWriter = new StringWriter()) { using (XmlWriter writer = XmlWriter.Create(stringWriter, XmlExtensions.FragmentWriterSettings)) ToXml(writer); return stringWriter.ToString(); } } internal void ToXml(XmlWriter writer) { writer.WriteStartElement("test-message"); writer.WriteAttributeString("destination", Destination); if (TestId != null) writer.WriteAttributeString("testid", TestId); writer.WriteCDataSafe(Message); writer.WriteEndElement(); } } }