Class ArgumentFormatter
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
MaxEnumerableLength
Gets the maximum number of values printed for collections before truncation.
public static int MaxEnumerableLength { get; }
Property Value
MaxObjectDepth
Gets the maximum printing depth, in terms of objects before truncation.
public static int MaxObjectDepth { get; }
Property Value
MaxObjectMemberCount
Gets the maximum number of items (properties or fields) printed in an object before truncation.
public static int MaxObjectMemberCount { get; }
Property Value
MaxStringLength
Gets the maximum strength length before truncation.
public static int MaxStringLength { get; }
Property Value
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
sstringThe string value to be escaped
Returns
Format(object?, int)
Formats a value for display.
public static string Format(object? value, int depth = 1)
Parameters
valueobjectThe value to be formatted
depthintThe optional printing depth (1 indicates a top-level value)
Returns
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
typeTypeThe type to get the formatted name of
fullTypeNameboolSet to
trueto include the namespace; set tofalsefor just the simple type name