TestMessage
The TestMessage class holds a message sent by a test to all listeners
using System;
using System.Diagnostics;
namespace NUnit.Framework.Interfaces
{
[DebuggerDisplay("{ToString(),nq}")]
public sealed class TestMessage
{
public string Message { get; }
public string Destination { get; }
public string TestId { get; }
public TestMessage(string destination, string text, string testId)
{
if (destination == null)
throw new ArgumentNullException("destination");
if (text == null)
throw new ArgumentNullException("text");
Destination = destination;
Message = text;
TestId = testId;
}
public override string ToString()
{
return Destination + ": " + Message;
}
public string ToXml()
{
TNode tNode = new TNode("test-message", Message, true);
if (Destination != null)
tNode.AddAttribute("destination", Destination);
if (TestId != null)
tNode.AddAttribute("testid", TestId);
return tNode.OuterXml;
}
}
}