Search Results for

    Show / Hide Table of Contents

    Class MessageWriter

    MessageWriter is the abstract base for classes that write constraint descriptions and messages in some form. The class has separate methods for writing various components of a message, allowing implementations to tailor the presentation as needed.

    Inheritance
    object
    MarshalByRefObject
    TextWriter
    StringWriter
    MessageWriter
    Implements
    IDisposable
    IAsyncDisposable
    Inherited Members
    StringWriter.Close()
    StringWriter.Dispose(bool)
    StringWriter.GetStringBuilder()
    StringWriter.Write(char)
    StringWriter.Write(char[], int, int)
    StringWriter.Write(ReadOnlySpan<char>)
    StringWriter.Write(string)
    StringWriter.Write(StringBuilder)
    StringWriter.WriteLine(ReadOnlySpan<char>)
    StringWriter.WriteLine(StringBuilder)
    StringWriter.WriteAsync(char)
    StringWriter.WriteAsync(string)
    StringWriter.WriteAsync(char[], int, int)
    StringWriter.WriteAsync(ReadOnlyMemory<char>, CancellationToken)
    StringWriter.WriteAsync(StringBuilder, CancellationToken)
    StringWriter.WriteLineAsync(char)
    StringWriter.WriteLineAsync(string)
    StringWriter.WriteLineAsync(StringBuilder, CancellationToken)
    StringWriter.WriteLineAsync(char[], int, int)
    StringWriter.WriteLineAsync(ReadOnlyMemory<char>, CancellationToken)
    StringWriter.FlushAsync()
    StringWriter.ToString()
    StringWriter.Encoding
    TextWriter.Null
    TextWriter.CoreNewLine
    TextWriter.Dispose()
    TextWriter.DisposeAsync()
    TextWriter.Flush()
    TextWriter.Write(char[])
    TextWriter.Write(bool)
    TextWriter.Write(int)
    TextWriter.Write(uint)
    TextWriter.Write(long)
    TextWriter.Write(ulong)
    TextWriter.Write(float)
    TextWriter.Write(double)
    TextWriter.Write(decimal)
    TextWriter.Write(object)
    TextWriter.Write(string, object)
    TextWriter.Write(string, object, object)
    TextWriter.Write(string, object, object, object)
    TextWriter.Write(string, params object[])
    TextWriter.Write(string, params ReadOnlySpan<object>)
    TextWriter.WriteLine()
    TextWriter.WriteLine(char)
    TextWriter.WriteLine(char[])
    TextWriter.WriteLine(char[], int, int)
    TextWriter.WriteLine(bool)
    TextWriter.WriteLine(int)
    TextWriter.WriteLine(uint)
    TextWriter.WriteLine(long)
    TextWriter.WriteLine(ulong)
    TextWriter.WriteLine(float)
    TextWriter.WriteLine(double)
    TextWriter.WriteLine(decimal)
    TextWriter.WriteLine(string)
    TextWriter.WriteLine(object)
    TextWriter.WriteLine(string, object)
    TextWriter.WriteLine(string, object, object)
    TextWriter.WriteLine(string, object, object, object)
    TextWriter.WriteLine(string, params object[])
    TextWriter.WriteLine(string, params ReadOnlySpan<object>)
    TextWriter.WriteAsync(char[])
    TextWriter.WriteLineAsync(char[])
    TextWriter.WriteLineAsync()
    TextWriter.FlushAsync(CancellationToken)
    TextWriter.Synchronized(TextWriter)
    TextWriter.CreateBroadcasting(params TextWriter[])
    TextWriter.FormatProvider
    TextWriter.NewLine
    MarshalByRefObject.GetLifetimeService()
    MarshalByRefObject.InitializeLifetimeService()
    MarshalByRefObject.MemberwiseClone(bool)
    object.GetType()
    object.MemberwiseClone()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: NUnit.Framework.Constraints
    Assembly: nunit.framework.dll
    Syntax
    public abstract class MessageWriter : StringWriter, IDisposable, IAsyncDisposable

    Constructors

    View Source

    MessageWriter()

    Construct a MessageWriter given a culture

    Declaration
    protected MessageWriter()

    Properties

    View Source

    MaxLineLength

    Abstract method to get the max line length

    Declaration
    public abstract int MaxLineLength { get; set; }
    Property Value
    Type Description
    int

    Methods

    View Source

    DisplayDifferences(ConstraintResult)

    Display Expected and Actual lines for a constraint. This is called by MessageWriter's default implementation of WriteMessageTo and provides the generic two-line display.

    Declaration
    public abstract void DisplayDifferences(ConstraintResult result)
    Parameters
    Type Name Description
    ConstraintResult result

    The failing constraint result

    View Source

    DisplayDifferences(object?, object?)

    Display Expected and Actual lines for given values. This method may be called by constraints that need more control over the display of actual and expected values than is provided by the default implementation.

    Declaration
    public abstract void DisplayDifferences(object? expected, object? actual)
    Parameters
    Type Name Description
    object expected

    The expected value

    object actual

    The actual value causing the failure

    View Source

    DisplayDifferences(object?, object?, Tolerance?)

    Display Expected and Actual lines for given values, including a tolerance value on the Expected line.

    Declaration
    public abstract void DisplayDifferences(object? expected, object? actual, Tolerance? tolerance)
    Parameters
    Type Name Description
    object expected

    The expected value

    object actual

    The actual value causing the failure

    Tolerance tolerance

    The tolerance within which the test was made

    View Source

    DisplayStringDifferences(string, string, int, bool, bool)

    Display the expected and actual string values on separate lines. If the mismatch parameter is >=0, an additional line is displayed line containing a caret that points to the mismatch point.

    Declaration
    public abstract void DisplayStringDifferences(string expected, string actual, int mismatch, bool ignoreCase, bool clipping)
    Parameters
    Type Name Description
    string expected

    The expected string value

    string actual

    The actual string value

    int mismatch

    The point in expected at which the strings don't match or -1

    bool ignoreCase

    If true, case is ignored in locating the point where the strings differ

    bool clipping

    If true, the strings should be clipped to fit the line

    View Source

    DisplayStringDifferences(string, string, int, int, bool, bool, bool)

    Display the expected and actual string values on separate lines. If the mismatch parameter is >=0, an additional line is displayed line containing a caret that points to the mismatch point.

    Declaration
    public virtual void DisplayStringDifferences(string expected, string actual, int mismatchExpected, int mismatchActual, bool ignoreCase, bool ignoreWhiteSpace, bool clipping)
    Parameters
    Type Name Description
    string expected

    The expected string value

    string actual

    The actual string value

    int mismatchExpected

    The point in expected at which the strings don't match or -1

    int mismatchActual

    The point in actual at which the strings don't match or -1

    bool ignoreCase

    If true, case is ignored in locating the point where the strings differ

    bool ignoreWhiteSpace

    If true, white space is ignored in locating the point where the strings differ

    bool clipping

    If true, the strings should be clipped to fit the line

    View Source

    WriteActualValue(object?)

    Writes the text for an actual value.

    Declaration
    public abstract void WriteActualValue(object? actual)
    Parameters
    Type Name Description
    object actual

    The actual value.

    View Source

    WriteCollectionElements(IEnumerable, long, int)

    Writes the text for a collection value, starting at a particular point, to a max length

    Declaration
    public abstract void WriteCollectionElements(IEnumerable collection, long start, int max)
    Parameters
    Type Name Description
    IEnumerable collection

    The collection containing elements to write.

    long start

    The starting point of the elements to write

    int max

    The maximum number of elements to write

    View Source

    WriteMessageLine(int, string, params object?[]?)

    Method to write single line message with optional args, usually written to precede the general failure message, at a given indentation level.

    Declaration
    public abstract void WriteMessageLine(int level, string message, params object?[]? args)
    Parameters
    Type Name Description
    int level

    The indentation level of the message

    string message

    The message to be written

    object[] args

    Any arguments used in formatting the message

    View Source

    WriteMessageLine(string, params object?[]?)

    Method to write single line message with optional args, usually written to precede the general failure message.

    Declaration
    public void WriteMessageLine(string message, params object?[]? args)
    Parameters
    Type Name Description
    string message

    The message to be written

    object[] args

    Any arguments used in formatting the message

    View Source

    WriteValue(object?)

    Writes the text for a generalized value.

    Declaration
    public abstract void WriteValue(object? val)
    Parameters
    Type Name Description
    object val

    The value.

    Implements

    IDisposable
    IAsyncDisposable
    • View Source
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0