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

MsgUtils

static class MsgUtils
Static methods used in creating messages
public static ValueFormatter DefaultValueFormatter { get; set; }

Current head of chain of value formatters. Public for testing.

public static void AddFormatter(ValueFormatterFactory formatterFactory)

Add a formatter to the chain of responsibility.

public static void ClipExpectedAndActual(ref string expected, ref string actual, int maxDisplayLength, ref int mismatchExpected, ref int mismatchActual)

Clip the expected and actual strings in a coordinated fashion, so that they may be displayed together.

public static string ClipString(string s, int clipLength, int clipStart)

Clip a string to a given length, starting at a particular offset, returning the clipped string with ellipses representing the removed parts

public static string ClipWhenNeeded(string s, int length, int maxDisplayLength, ref int mismatchLocation)

Clips the s string if it exceeds maxDisplayLength.

public static string EscapeControlChars(string s)

Converts any control characters in a string to their escaped representation.

public static string EscapeControlChars(string s, ref int index)

Converts any control characters in a string to their escaped representation.

public static string EscapeNullCharacters(string s)

Converts any null characters in a string to their escaped representation.

public static ValueTuple<int, int> FindMismatchPosition(string expected, string actual, bool ignoreCase, bool ignoreWhiteSpace)

Finds the position two strings start to differ.

public static string FormatCollection(IEnumerable collection, long start = 0, int max = 10)

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

public static string FormatValue(object val)

Formats text to represent a generalized value.

public static string GetArrayIndicesAsString(int[] indices)

Return the a string representation for a set of indices into an array

public static int[] GetArrayIndicesFromCollectionIndex(IEnumerable collection, long index)

Get an array of indices representing the point in a collection or array corresponding to a single int index into the collection.

public static string GetTypeRepresentation(object obj)

Returns the representation of a type as used in NUnitLite. This is the same as Type.ToString() except for arrays, which are displayed with their declared sizes.