Table of Contents

Class ArgumentFormatter

Namespace
Xunit.Sdk
Assembly
xunit.v3.assert.dll

Formats value for display in assertion messages and data-driven test display names.

public static class ArgumentFormatter
Inheritance
ArgumentFormatter
Inherited Members

Properties

Ellipsis

Gets the ellipsis value (three middle dots, aka U+00B7).

public static string Ellipsis { get; }

Property Value

string

MaxEnumerableLength

Gets the maximum number of values printed for collections before truncation.

public static int MaxEnumerableLength { get; }

Property Value

int

MaxObjectDepth

Gets the maximum printing depth, in terms of objects before truncation.

public static int MaxObjectDepth { get; }

Property Value

int

MaxObjectMemberCount

Gets the maximum number of items (properties or fields) printed in an object before truncation.

public static int MaxObjectMemberCount { get; }

Property Value

int

MaxStringLength

Gets the maximum strength length before truncation.

public static int MaxStringLength { get; }

Property Value

int

Methods

EscapeString(string)

Escapes a string for printing, attempting to most closely model the value on how you would enter the value in a C# string literal. That means control codes that are normally backslash escaped (like "\n" for newline) are represented like that; all other control codes for ASCII values under 32 are printed as "\xnn".

public static string EscapeString(string s)

Parameters

s string

The string value to be escaped

Returns

string

Format(object?, int)

Formats a value for display.

public static string Format(object? value, int depth = 1)

Parameters

value object

The value to be formatted

depth int

The optional printing depth (1 indicates a top-level value)

Returns

string

FormatTypeName(Type, bool)

Formats a type. This maps built-in C# types to their C# native name (e.g., printing "int" instead of "Int32" or "System.Int32").

public static string FormatTypeName(Type type, bool fullTypeName = false)

Parameters

type Type

The type to get the formatted name of

fullTypeName bool

Set to true to include the namespace; set to false for just the simple type name

Returns

string