xunit.v3.common
Represents an endpoint for the reception of test messages.
Reports the presence of a message on the message bus. This method should
never throw exceptions.
The message from the message bus
Return true to continue running tests, or false to stop.
Base interface for all test messages. A test message is a message that is used to communicate
the status of discovery and/or execution of tests.
Base interface for all messages related to test assemblies.
Gets the assembly's unique ID. Can be used to correlate test messages with the appropriate
assembly that they're related to.
Base interface for all messages related to test cases.
Gets the test case's unique ID. Can be used to correlate test messages with the appropriate
test case that they're related to.
Base interface for all messages related to test classes.
Gets the test class's unique ID. Can be used to correlate test messages with the appropriate
test class that they're related to. Will be null if the test did not originate from a class.
Base interface for all messages related to test collections.
Gets the test collection's unique ID. Can be used to correlate test messages with the appropriate
test collection that they're related to.
Base interface for all messages related to tests.
Gets the test's unique ID. Can be used to correlate test messages with the appropriate
test that they're related to.
Base interface for all messages related to test methods.
Gets the test method's unique ID. Can be used to correlate test messages with the appropriate
test method that they're related to. Will be null if the test did not originate from a method.
Base interface for all individual test results (e.g., tests which pass, fail, skipped, or aren't run).
Gets the date and time when the test execution finished.
This message is sent during execution to indicate that the After method of a
just finished executing.
Gets the fully qualified type name of the .
This message is sent during execution to indicate that the After method of a
is about to execute.
Gets the fully qualified type name of the .
This message is sent during execution to indicate that the Before method of a
has completed executing.
Gets the fully qualified type name of the .
This message is sent during execution to indicate that the Before method of a
is about to execute.
Gets the fully qualified type name of the .
This message is sent when code (1st or 3rd party) wants to alert the user to a situation that may require
diagnostic investigation. This is typically not displayed unless the user has explicitly asked for diagnostic
messages to be displayed (see on
how to enable display of diagnostic messages).
Gets the diagnostic message.
This message indicates that the discovery process has been completed for
the requested assembly.
Gets a count of the number of test cases that passed the filter and will be run.
This message indicates that the discovery process is starting for
the requested assembly.
Gets the assembly name. May return a simple assembly name (i.e., "mscorlib"), or may return a
fully qualified name (i.e., "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089").
Gets the on-disk location of the assembly under test.
Gets the full path of the configuration file name, if one is present.
May be null if there is no configuration file.
This message indicates that a catastrophic error has occurred.
This message is sent when xUnit.net itself wants to log internal messages and state that are typically only
used by the xUnit.net team to gain a deeper understanding of potential end user issues. These messages are
rarely useful to end users directly, and may result in very noisy logs. This is typically not displayed
unless the user has explicit asked for internal diagnostic messages to be displayed (see
on how to enable
display of internal diagnostic messages).
Gets the internal diagnostic message.
This message indicates that an error has occurred during test assembly cleanup.
This message indicates that the execution process has been completed for
the requested assembly.
Gets the date and time when the test assembly execution finished.
This message indicates that the execution process is about to start for
the requested assembly.
Gets the seed value used for randomization. If null, then the test framework
does not support getting or setting a randomization seed. (For stock versions of xUnit.net,
support for settable randomization seeds started with v3.)
Gets the date and time when the test assembly execution began.
Gets the target framework that the assembly was compiled against.
Examples: ".NETFramework,Version=v4.7.2", ".NETCoreApp,Version=v6.0". This information
is read from on the test assembly, which
is normally auto-generated (but could be missing or empty).
Gets a display string that describes the test execution environment.
Examples: "32-bit .NET Framework 4.8.4220.0", "64-bit .NET Core 4.6.29220.03"
Gets a display string which describes the test framework and version number.
Examples: "xUnit.net v3 0.1.0-pre.15", "xUnit.net 2.4.1"
This message indicates that an error has occurred during test case cleanup.
This message indicates that a test case had been found during the discovery process.
Gets the serialized value of the test case, which allows it to be transferred across
process boundaries.
This message indicates that a test case has finished executing.
This message indicates that a test case is about to start executing.
This message indicates that an error has occurred during test class cleanup.
This message indicates that an instance of a test class has just been constructed.
Instance (non-static) methods of tests get a new instance of the test class for each
individual test execution; static methods do not get an instance of the test class.
This message indicates that an instance of a test class is about to be constructed.
Instance (non-static) methods of tests get a new instance of the test class for each
individual test execution; static methods do not get an instance of the test class.
This message indicates that the or
method was just called on the test class
for the test that just finished executing.
This message indicates that the or
method is about to be called on the
test class for the test that just finished executing.
This message indicates that a test class has finished executing (meaning, all of the
test cases in this test class have finished running).
This message indicates that a test class is about to begin executing.
This message indicates that an error has occurred during test cleanup.
This message indicates that an error has occurred during test collection cleanup.
This message indicates that a test collection has just finished executing (meaning,
all the test classes in the collection has finished).
This message indicates that a test collection is about to start executing.
This message indicates that a test has failed.
Gets the cause of the test failure.
This message indicates that a test has finished executing.
Gets any attachments that were added to the test result via .
This message indicates that an error has occurred during test method cleanup.
This message indicates that a test method has finished executing (meaning, all
the test cases that derived from the test method have finished).
This message indicates that a test method is about to begin executing.
This message indicates that a test was not run because it was excluded (either because
it was marked as explicit and explicit tests weren't run, or because it was marked as
not explicit as only explicit tests were run).
This message indicates that a line of output was provided for a test.
Gets the line of output.
Indicates that a test has passed.
This message indicates that a test was skipped.
Gets the reason given for skipping the test.
This message indicates that a test is about to start executing.
Gets a flag which indicates whether the test is marked as explicit or not.
Gets the date and time when the test execution began.
Gets the timeout for the test, in milliseconds; if 0, there is no timeout.
Represents metadata about a test assembly.
Gets the assembly name. May return a simple assembly name (i.e., "mscorlib"), or may return a
fully qualified name (i.e., "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089").
Gets the on-disk location of the assembly under test.
Gets the full path of the configuration file name, if one is present.
May be null if there is no configuration file.
Gets the trait values associated with this test assembly. If
there are none, or the framework does not support traits,
this should return an empty dictionary (not null).
Gets the unique ID for this test assembly.
The unique identifier for a test assembly should be able to discriminate among test assemblies with
their associated configuration file (so the same assembly with two different configuration files
should have two different unique IDs). This identifier should remain stable until such time as
the developer changes some fundamental part of the identity. Recompilation of the test assembly
is reasonable as a stability changing event.
Represents metadata about an error during test discovery or execution.
Gets the parent exception index(es) for the exception(s); a -1 indicates
that the exception in question has no parent.
Gets the fully-qualified type name(s) of the exception(s).
Gets the message(s) of the exception(s).
Gets the stack trace(s) of the exception(s).
This is metadata describing the execution of a single test.
The time spent executing the test, in seconds. Will be 0 if the test was not executed.
The captured output of the test. Will be if there was no output.
Gets a list of the warning messages that were recorded during execution. Will be null
if there were no warnings.
This is metadata describing the summary during various phases of execution process (e.g.,
test case, test class, test collection, and assembly). It describes the aggregation of
zero or more tests being executed.
Gets the execution time (in seconds) for this execution.
Gets the number of failing tests.
Gets the number of tests that were not run. This includes explicit tests when explicit tests are not run,
or non-expicit tests when non-explicit tests are not run.
Gets the number of skipped tests.
Gets the total number of tests run and not run.
Represents metadata about a test case.
Gets a flag indicating whether this test case was marked as explicit or not.
Gets the display text for the reason a test is being skipped; if the test
is not statically skipped, returns null. (A test may be dynamically
skipped at runtime while still returning null.)
Gets the source file name. A null value indicates that the
source file name is not known.
Gets the source file line number. A null value indicates that the
source file line number is not known.
Gets the display name of the test case.
Gets the for the test class. If the test did not
originate in a class, will return null.
This value is only populated for xUnit.net v3 or later test cases, and will return null
for v1 or v2 test cases, regardless of whether is null.
Gets the full name of the class where the test is defined (i.e., ).
If the test did not originiate in a class, will return null.
Gets the namespace of the class where the test is defined. If the test did not
originate in a class, or the class it originated in does not reside in a namespace,
will return null.
Gets the simple name of the class where the test is defined (the class name without namespace).
If the test did not originiate in a class, will return null.
Gets the arity (number of generic types) on the method itself. If the test did not originate
in a method, will return null.
Gets the for the test method. If the test did not
originate in a method, or the test framework did not provide this information, will return null.
This value is only populated for xUnit.net v3 or later test cases, and will return null
for v1 or v2 test cases, regardless of whether is null.
Gets the method name where the test is defined, in the class.
If the test did not originiate in a method, will return null.
Gets the types for the test method parameters. If the test did not originate in a method,
or the test framework does not provide this information, will return null; if the test
method has no parameters, will return an empty array.
The values here are formatted according to
VSTest rules
in order to support Test Explorer. Note that this is not the same as .
Gets the test method return type. If the test did not originate in a method, or the test framework
did not provide this information, will return null.
The value here is formatted according to
VSTest rules
in order to support Test Explorer. Note that this is not the same as .
Gets the trait values associated with this test case. If there are none, or the framework
does not support traits, this should return an empty dictionary (not null).
Gets a unique identifier for the test case.
The unique identifier for a test case should be able to discriminate among test cases, even those
which are varied invocations against the same test method (i.e., theories). This identifier should
remain stable until such time as the developer changes some fundamental part of the identity
(assembly, class name, test name, or test data). Recompilation of the test assembly is reasonable
as a stability changing event.
Represents metadata about a test class.
Gets the full name of the test class (i.e., ).
Gets the namespace of the class where the test is defined. Will return null for
classes not residing in a namespace.
Gets the simple name of the test class (the class name without namespace).
Gets the trait values associated with this test class (and the test collection, and test
assembly). If there are none, or the framework does not support traits, this returns an
empty dictionary (not null).
Gets the unique ID for this test class.
The unique identifier for a test class should be able to discriminate among test classes in the
same test assembly. This identifier should remain stable until such time as the developer changes
some fundamental part of the identity (assembly, collection, or test class). Recompilation of the
test assembly is reasonable as a stability changing event.
Represents metadata about a test collection.
Gets the type that the test collection was defined with, if available; may be null
if the test collection didn't have a definition type.
Gets the display name of the test collection.
Gets the trait values associated with this test collection (and the test assembly).
If there are none, or the framework does not support traits, this returns an empty
dictionary (not null).
Gets the unique ID for this test collection.
The unique identifier for a test collection should be able to discriminate among test collections
in the same test assembly. This identifier should remain stable until such time as the developer
changes some fundamental part of the identity (the test assembly, the collection definition
class, or the collection name). Recompilation of the test assembly is reasonable as a stability
changing event.
Represents metadata about a test.
Gets the display name of the test.
Gets the trait values associated with this test case. If
there are none, or the framework does not support traits,
this should return an empty dictionary (not null).
Gets a unique identifier for the test.
The unique identifier for a test should be able to discriminate among test, even those which are
varied invocations against the same test method (i.e., theories). This identifier should remain
stable until such time as the developer changes some fundamental part of the identity (assembly,
class name, test name, or test data). Recompilation of the test assembly is reasonable as a
stability changing event.
Represents metadata about a test method.
Gets the arity (number of generic types) of the test method. May return null if
the arity of the test method is unknown (for example, for v1 or v2 test methods where
arity information was not collected).
Gets the name of the test method that is associated with this message.
Gets the trait values associated with this test method (and the test class,
test collection, and test assembly). If there are none, or the framework does
not support traits, this returns an empty dictionary (not null).
Gets the unique ID for this test method.
The unique identifier for a test method should be able to discriminate among test methods in the
same test assembly. This identifier should remain stable until such time as the developer changes
some fundamental part of the identity (assembly, collection, test class, or test method).
Recompilation of the test assembly is reasonable as a stability changing event.
Represents a single test in the system. A test case typically contains only a single test,
but may contain many if circumstances warrant it (for example, test data for a theory cannot
be pre-enumerated, so the theory yields a single test case with multiple tests).
Gets the test case this test belongs to.
Represents a test assembly.
Although most test frameworks will use an for the test assembly,
this is not a requirement at this layer. Assembly is just an abstraction that represents
a group of zero or more s.
Returns the module version ID of the test assembly. Used as the basis for randomization.
Represents a single test case in the system. This test case usually represents a single test, but in
the case of dynamically generated data for data driven tests, the test case may actually return
multiple results when run.
Gets the test class that this test case belongs to; may be null if the test isn't backed by
a class, but will not be null if is not null (and must be
the same instance returned via ).
Gets the test collection this test case belongs to. Must be the same instance returned
via and/or when they are not null.
Gets the test method this test case belongs to; may be null if the test isn't backed by
a method.
Represents a test class, which contributes one or more test cases (usually by
way of test methods).
Not all test frameworks will require that tests come from classes, so this abstraction
may or many not be used.
Gets the test collection this test class belongs to.
Represents a group of test cases.
The test framework decides how test collections are defined and what their purpose is.
Gets the test assembly this test collection belongs to.
Represents a test method, which contributes one or more test cases.
Not all test frameworks will require that tests come from methods, so this abstraction
may or many not be used.
Gets the test class that this test method belongs to.
Represents an instance of that is to be used for
test discovery purposes.
Represents an instance of that is to be used for
test execution purposes.
This interface should not be consumed directly; instead, you should
consume
or .
Gets an option value.
The type of the value.
The name of the value.
The value.
Sets an option value.
The type of the value.
The name of the value.
The value to be set.
Converts the test framework options into JSON. Used for serializing the options
for sending across a process boundary.
The serialized framework options.
Used to decorate xUnit.net test assemblies to register an external serializer for
one or more supports types to serialize.
Serializer registration attributes are only valid at the assembly level.
Gets the type of the serializer.
The serializer type must implement .
Gets the types that are supported by the serializer.
When searching for a serializer to deserialize a value, exact type matches are
given higher priority than compatible type matches, and if more than one serializer
can support a given type based on compatible type match, then one will be chosen
arbitrarily to support the deserialization.
This interface should be implemented by any custom object which requires serialization.
In addition to implementing this interface, objects must also offer a parameterless
public constructor so that an empty object can be created to be deserialized into.
Called when the object should populate itself with data from the serialization info.
The info to get the object data from
Called when the object should store its serialized values into the serialization info.
The info to store the object data into
An interface that is implemented by the serialization infrastructure in xUnit.net.
This is passed to objects which implement so they
can serialize and deserialize themselves from the serialization store.
Adds a value to the serialization. Supported value types include the built-in
intrinsics (string, int, long, float, double, and decimal, including nullable
versions of those), any class which implements ),
or arrays of any supported types.
The key to store the value with
The value to be stored
The type of the value to be stored; optional, unless the
value of is null.
Thrown if the value is not a supported type.
Gets a value from the serialization.
The key of the value to retrieve
The value, if present; null, otherwise
Implemented by types which can support serialization and deserialization. This
allows external serializers for types which would be inconvenient or impossible
to implement directly.
Deserializes a value that was obtained from .
The type of the original value
The serialized value
The deserialized value
Determines if a specific value of data is serializable.
The type of the value
The value to test
Returns a failure reason when the value isn't serializable
Return true if the value is serializable; false, otherwise
This will be called by ,
, and
. The failure reason is used when
called from Serialize to format an error exception, but is otherwise ignored
from the calls from IsSerializable.
The type of may not directly match , as the type
is derived from unwrapping nullability and array element types, so use care when looking
at the value to determine serializability.
Serializes a value into a string to be later deserialized with .
The value to be serialized
The serialized value
This method will never be called with null values, because those are already
special cased by the serialization system. You may assume that
is called before this, so any validation done there need not be repeated here.
Extension methods for .
Computes the simple assembly name from .
The simple assembly name.
Extension methods for the JSON serialization types.
Serializes an array of integers into the object.
The key to serialize the array to
The values in the array
Whether to serialize the array if it's null
Serializes an array of strings into the object.
The key to serialize the array to
The values in the array
Whether to serialize the array if it's null
Serialize a trait dictionary value into the object.
The name of the value
The trait dictionary
A flag to indicate whether to render empty traits
Extension methods for reflection types in .NET.
Gets the arity (number of generic types) of the method.
Returns the default value for the given type. For value types, this means a 0-initialized
instance of the type; for reference types, this means null.
The type to get the default value of.
The default value for the given type.
Formulates the extended portion of the display name for a test method. For tests with no arguments, this will
return just the base name; for tests with arguments, attempts to format the arguments and appends the argument
list to the test name.
The test method
The base part of the display name
The test method arguments
The test method's generic types
The full display name for the test method
Gets all the custom attributes for the assembly that are of the given attribute type.
The assembly to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
The matching attributes that decorate the assembly
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the assembly that are of the given attribute type.
The assembly to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the assembly
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the assembly that are of the given attribute type.
The assembly to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
The matching attributes that decorate the assembly
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the assembly that are of the given attribute type.
The assembly to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the assembly
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the assembly that are of the given attribute type.
The assembly to get custom attributes for.
The matching attributes that decorate the assembly
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the assembly that are of the given attribute type.
The assembly to get custom attributes for.
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the assembly
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the attribute that are of the given attribute type.
The attribute to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
The matching attributes that decorate the attribute
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the attribute that are of the given attribute type.
The attribute to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the attribute
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the attribute that are of the given attribute type.
The attribute to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
The matching attributes that decorate the attribute
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the attribute that are of the given attribute type.
The attribute to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the attribute
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the attribute that are of the given attribute type.
The attribute to get custom attributes for.
The matching attributes that decorate the attribute
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the attribute that are of the given attribute type.
The attribute to get custom attributes for.
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the attribute
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the method that are of the given attribute type.
The method to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
The matching attributes that decorate the method
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the method that are of the given attribute type.
The method to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the method
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the method that are of the given attribute type.
The method to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
The matching attributes that decorate the method
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the method that are of the given attribute type.
The method to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the method
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the method that are of the given attribute type.
The method to get custom attributes for.
The matching attributes that decorate the method
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the method that are of the given attribute type.
The method to get custom attributes for.
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the method
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the parameter that are of the given attribute type.
The parameter to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
The matching attributes that decorate the parameter
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the parameter that are of the given attribute type.
The parameter to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the parameter
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the parameter that are of the given attribute type.
The parameter to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
The matching attributes that decorate the parameter
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the parameter that are of the given attribute type.
The parameter to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the parameter
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the parameter that are of the given attribute type.
The parameter to get custom attributes for.
The matching attributes that decorate the parameter
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the parameter that are of the given attribute type.
The parameter to get custom attributes for.
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the parameter
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the type that are of the given attribute type.
The type to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
The matching attributes that decorate the type
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the type that are of the given attribute type.
The type to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the type
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the type that are of the given attribute type.
The type to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
The matching attributes that decorate the type
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the type that are of the given attribute type.
The type to get custom attributes for.
The type of the attribute to find. Will accept attribute types that are concrete,
closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will
return matching closed generic attributes (e.g., MyAttribute>int<)
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the type
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the type that are of the given attribute type.
The type to get custom attributes for.
The matching attributes that decorate the type
This method safely skips attributes that throw in their constructor.
Gets all the custom attributes for the type that are of the given attribute type.
The type to get custom attributes for.
A collection to fill with warning messages about attribute construction failure
The matching attributes that decorate the type
This method safely skips attributes that throw in their constructor.
Determines if the given type implements the given interface.
The type to check
The interface type to look for
Returns true if the type implements the interface; false, otherwise
Determines if the given type is from a local assembly.
The type to verify
Returns true if the type originates in a local assembly; false if the type originates in the GAC.
Determines whether is a nullable type; that is, whether it
is a reference type or it represents for a value type.
Determines whether represents a nullable enum value.
Resolves all the generic types for a test method. The arguments are used to determine
the best matching generic types for the method that can be satisfied by all the generic
parameters and their argument values.
The method
The argument values being passed to the method
The best matching generic types
Resolves argument values for the test method, ensuring they are the correct type,
including support for optional method arguments.
The test method to resolve.
The user-supplied method arguments.
The argument values
Gets a fully qualified type name (i.e., ), falling back to a simple
type name (i.e., ) when a fully qualified name is not available. Typically
used when presenting type names to the user, or to guarantee the type name is never null.
Convert a collection of objects into a comma-separated list
for display purposes.
Converts a type into a name string for display purposes. It attempts to make a more user friendly
name than would give, especially when the type is generic.
Gets the simple name for a type, suitable for use with .
Converts a name into the correct form for VSTest managed type name for
using in managed TestCase properties and by xunit.runner.visualstudio.
See
Attempts to strip from a type value and just return T.
For non-nullable types, will return the type that was passed in.
Test options names
Test options names used with .
The culture to be used for discovery. null means the default system culture,
means the invariant culture, and any other value is assumed
to be a culture name that the system understands.
Value type:
Consumed by: v3
Set to true to enable display of diagnostic messages.
Value type:
Consumed by: v2, v3
Set to true to include source information during discovery, when possible. (Note that
most source information is applied by the runner, not the discoverer, because it utilizes the
DiaSession support provided by Visual Studio, which means it's applied after the fact
by xunit.runner.visualstudio. This flag, then, is a signal for custom test frameworks
that may be able to provide source information via some other mechanism.)
Value type:
Consumed by: v3
Set to true to enable display of internal diagnostic messages.
Value type:
Consumed by: v2, v3
A flag which indicates how the default test method display name is calculated.
Value type:
Consumed by: v2, v3
A flag which indicates how the test method display name calculation can be modified by special
naming patterns.
Value type:
Consumed by: v2, v3
Set to true to enable pre-enumeration of theories during discovery.
Value type:
Consumed by: v2, v3
Sets the maximum number of items to print in a collection.
Value type:
Consumed by: v3 1.1.0+
Sets the maximum recursive depth when printing object values.
Value type:
Consumed by: v3 1.1.0+
Sets the maximum number of members to show when printing object values.
Value type:
Consumed by: v3 1.1.0+
Sets the maximum length when printing a string value.
Value type:
Consumed by: v3 1.1.0+
Set to true to enable synchronous message reporting; set to false to enable
asynchronous message reporting. Synchronous in this case means the system will wait for the
runner to process a message before delivering the next one.
Value type:
Consumed by: v2, v3
Test options names used with .
The maximum recursive depth for object comparisons with Assert.Equivalent.
Value type:
Consumed by: v3 1.1.0+
The culture to be used for execution. null means the default system culture,
means the invariant culture, and any other value is assumed
to be a culture name that the system understands.
Value type:
Consumed by: v3
Set to true to enable display of diagnostic messages.
Value type:
Consumed by: v2, v3
Set to true to disable running tests in parallel.
Value type:
Consumed by: v2, v3
Gets a flag which indicates the user's desire to run explicit tests.
Value type:
Consumed by: v3
Set to true to convert skipped tests into failed tests.
Value type:
Consumed by: v3
Set to true to convert passing tests with warnings into failed tests.
Value type:
Consumed by: v3
Set to true to enable display of internal diagnostic messages.
Value type:
Consumed by: v2, v3
Sets the maximum number of parallel threads to use during execution. Set to -1
to run with unlimited threads; set to 0 to use the system default (equal to
; set to any other positive integer to use
that number of threads.
Value type:
Consumed by: v2, v3
Set the algorithm to use for parallelization.
Value type:
Consumed by: v2, v3
Sets the maximum number of items to print in a collection.
Value type:
Consumed by: v3 1.1.0+
Sets the maximum recursive depth when printing object values.
Value type:
Consumed by: v3 1.1.0+
Sets the maximum number of members to show when printing object values.
Value type:
Consumed by: v3 1.1.0+
Sets the maximum length when printing a string value.
Value type:
Consumed by: v3 1.1.0+
Set the seed to use for randomization. When unset (or set to null), will use the default
system-computed seed.
Value type:
Consumed by: v3
Set to true to show output live while tests are running, in addition to showing collected output
when the test has finished.
Value type:
Consumed by: v2, v3
Set to true to attempt to stop execution as soon the first test fails.
Value type:
Consumed by: v2, v3
Set to true to enable synchronous message reporting; set to false to enable
asynchronous message reporting. Synchronous in this case means the system will wait for the
runner to process a message before delivering the next one.
Value type:
Consumed by: v2, v3
Indicates that an object can be deserialized from string-serialized JSON.
Deserializes the object's values from the provided JSON.
The root of the deserialized JSON object
Interface that indicates an object can be serialized to JSON.
Converts the given object to JSON.
Returns the object in JSON form, if possible; returns null if the object
cannot be represented in JSON form.
A special-purpose streaming serializer for arrays to JSON. Only supports a limited number of
types (boolean, DateTimeOffset, decimal, Enum, int, long, string, and trait dictionaries).
These types are made public for third parties only for the purpose of serializing and
deserializing messages that are sent across the process boundary (that is, types which
implement ). Any other usage is not supported.
The buffer to write JSON to
An optional callback to be notified when disposed
A special-purpose streaming serializer for arrays to JSON. Only supports a limited number of
types (boolean, DateTimeOffset, decimal, Enum, int, long, string, and trait dictionaries).
These types are made public for third parties only for the purpose of serializing and
deserializing messages that are sent across the process boundary (that is, types which
implement ). Any other usage is not supported.
The buffer to write JSON to
An optional callback to be notified when disposed
Serialize a value into the array.
Serialize a value into the array.
Serialize a value into the array.
Serialize an value into the array.
Serialize an value into the array.
Serialize a value into the array.
Serialize a trait dictionary value into the array.
Serialize a value into the array.
Start serializing an array into the array.
IMPORTANT: This serializer must be used completely and disposed before any other value
is serialized into the array, or the serialization will be corrupted.
Start serializing an object into the array.
IMPORTANT: This serializer must be used completely and disposed before any other value
is serialized into the array, or the serialization will be corrupted.
A special-purpose untyped deserializer for JSON. JSON strings are returned as ,
JSON numbers are returned as , JSON booleans are returns as ,
JSON objects are returned as IReadOnlyDictionary<string, object?>, JSON arrays are
returned as object?[], and JSON null values are returned as null. Static methods exist
here to help retrieve values from object dictionaries as well as convert to the commonly supported
data types (, , , ,
, , , and trait dictionaries (which are
decoded to IReadOnlyDictionary<string, IReadOnlyList<string>>), as well as arrays
of all the supported types (except trait dictionaries). Developers who need support for other types
are encouraged to encode and decode then as strings as needed (for examples, you can see how
and values are handled here).
These types are made public for third parties only for the purpose of serializing and
deserializing messages that are sent across the process boundary (that is, types which
implement ). Any other usage is not supported.
Tries to get an untyped array value from a deserialized JSON object.
The deserialized JSON object
The key for the value
Tries to get an untyped array value from a deserialized JSON value.
The deserialized JSON value
Tries to get an array of values from a deserialized JSON
object. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON object
The key for the value
Tries to get an array of values from a deserialized JSON
value. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON value
Tries to get an array of values from a deserialized JSON
object. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON object
The key for the value
Tries to get an array of values from a deserialized JSON
value. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON value
Tries to get an array of values from a deserialized JSON
object. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON object
The key for the value
Tries to get an array of values from a deserialized JSON
value. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON value
Tries to get an array of values from a deserialized JSON
object. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON object
The key for the value
Tries to get an array of values from a deserialized JSON
value. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON value
Tries to get an array of values from a deserialized JSON
object. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON object
The key for the value
Tries to get an array of values from a deserialized JSON
value. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON value
Tries to get an array of values from a deserialized JSON
object. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON object
The key for the value
Tries to get an array of values from a deserialized JSON
value. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON value
Tries to get an array of values from a deserialized JSON
object. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are permitted.
The deserialized JSON object
The key for the value
Tries to get an array of values from a deserialized JSON
value. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are permitted.
The deserialized JSON value
Tries to get an array of values from a deserialized JSON
object. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON object
The key for the value
Tries to get an array of values from a deserialized JSON
value. If the value isn't an array, or if any of the values in the array
aren't compatible with , then returns null.
Null values in the array are not permitted.
The deserialized JSON value
Tries to get a value from a deserialized JSON object.
The deserialized JSON object
The key for the value
Tries to get a value from a deserialized JSON value.
The deserialized JSON value
Tries to get a value from a deserialized JSON object.
The deserialized JSON object
The key for the value
Tries to get a value from a deserialized JSON value.
The deserialized JSON value
Tries to get a value from a deserialized JSON object.
The deserialized JSON object
The key for the value
Tries to get a value from a deserialized JSON value.
The deserialized JSON value
Tries to get an value from a deserialized JSON object.
The deserialized JSON object
The key for the value
Tries to get an value from a deserialized JSON value.
The deserialized JSON value
Tries to get an value from a deserialized JSON object.
The deserialized JSON object
The key for the value
Tries to get an value from a deserialized JSON value.
The deserialized JSON value
Tries to get a value from a deserialized JSON object.
The deserialized JSON object
The key for the value
Tries to get an value from a deserialized JSON value.
The deserialized JSON value
Tries to get an untyped object value from a deserialized JSON object.
The deserialized JSON object
The key for the value
Tries to get an untyped object value from a deserialized JSON value.
The deserialized JSON value
Tries to get a value from a deserialized JSON object.
The deserialized JSON object
The key for the value
Flag to indicate if a default empty string should be returned instead of null
Returns the value if present; null, otherwise.
Tries to get an value from a deserialized JSON value.
The deserialized JSON value
Flag to indicate if a default empty string should be returned instead of null
Returns the value if present; null, otherwise.
Tries to get a trait dictionary value from a deserialized JSON object.
The deserialized JSON object
The key for the value
Flag to indicate if a default empty dictionary should be returned instead of null
Tries to get a value from a deserialized JSON object.
The deserialized JSON object
The key for the value
Tries to get a value from a deserialized JSON value.
The deserialized JSON value
Tries to get a value from a deserialized JSON value.
The deserialized JSON value
Returns the value if present; null, otherwise.
A special-purpose streaming serializer for objects to JSON. Only supports a limited number of type
(boolean, DateTimeOffset, decimal, Enum, int, long, string, and trait dictionaries).
These types are made public for third parties only for the purpose of serializing and
deserializing messages that are sent across the process boundary (that is, types which
implement ). Any other usage is not supported.
The buffer to write JSON to
An optional callback to be notified when disposed
A special-purpose streaming serializer for objects to JSON. Only supports a limited number of type
(boolean, DateTimeOffset, decimal, Enum, int, long, string, and trait dictionaries).
These types are made public for third parties only for the purpose of serializing and
deserializing messages that are sent across the process boundary (that is, types which
implement ). Any other usage is not supported.
The buffer to write JSON to
An optional callback to be notified when disposed
Serialize a value into the object.
The name of the value
The value
Set to true to serialize a null value, or false to skip it
Serialize a value into the object.
The name of the value
The value
Set to true to serialize a null value, or false to skip it
Serialize a value into the object.
The name of the value
The value
Set to true to serialize a null value, or false to skip it
Serialize an value into the object.
The name of the value
The value
Set to true to serialize a null value, or false to skip it
Serialize an value into the object.
The name of the value
The value
Set to true to serialize a null value, or false to skip it
Serialize a value into the object.
The name of the value
The value
Set to true to serialize a null value, or false to skip it
Serialize a value into the object.
The name of the value
The value
Set to true to serialize a null value, or false to skip it
Set to true to serialize empty strings, or false to skip it
Serialize a value into the object.
The name of the value
The value
Set to true to serialize a null value, or false to skip it
Start serializing an array into the object.
The name of the array
IMPORTANT: This serializer must be used completely and disposed before any other value
is serialized into the object, or the serialization would be corrupted.
Serialize a null value into the object.
The name of the null value
Start serializing an object into the object.
The name of the object
IMPORTANT: This serializer must be used completely and disposed before any other value
is serialized into the object, or the serialization would be corrupted.
Base class used for streaming JSON serialization.
These types are made public for third parties only for the purpose of serializing and
deserializing messages that are sent across the process boundary (that is, types which
implement ). Any other usage is not supported.
Initializes a new instance of the class.
The buffer to write JSON to
A callback to be notified when disposed
The character to write when starting (i.e., '[' for arrays)
The character to write when finishing (i.e., ']' for arrays)
Used to decorate concrete serializable classes that implement to
indicate what the serialized type ID should be. The type IDs must be unique, and only assigned to
concrete types that will be serialized and deserialized.
These types are made public for third parties only for the purpose of serializing and
deserializing messages that are sent across the process boundary (that is, types which
implement ). Any other usage is not supported.
The JSON type ID
Used to decorate concrete serializable classes that implement to
indicate what the serialized type ID should be. The type IDs must be unique, and only assigned to
concrete types that will be serialized and deserialized.
These types are made public for third parties only for the purpose of serializing and
deserializing messages that are sent across the process boundary (that is, types which
implement ). Any other usage is not supported.
The JSON type ID
Indicates how explicit tests should be handled during execution.
Indicates the non-explicit tests should be run, and explicit tests should not be run. This
should be the default behavior in most runners.
Indicates that both non-explicit and explicit tests should be run.
Indicates that non-explicit tests should not be run, and explicit tests should be run.
Extension methods for
Determines if the value is a valid enum value.
Indicates the cause of the test failure.
Indicates the test failure cause is unknown.
Indicates that a test failed for some reason other than a typical execution failure
(for example, if a test was skipped but the flag was given to fail all skipped tests,
or the test passed with warnings but the flag was given to fail tests with warnings).
Indicates that the test failed because it threw an unhandled exception.
Indicates that the test failed because of an assertion failure (that is, an exception
was thrown that implements an interface named IAssertionException, regardless of the
namespace or source assembly of the interface). For built-in exceptions,
serves this purpose, but this is generally
found by convention rather than type to prevent 3rd party assertion libraries from needing
to take an explicit references to xUnit.net binaries.
Indicates that the test failed because it exceeded the allowed time to run (typically
specified via ). This is indicated by an
exception that is thrown which implements an interface named ITestTimeoutException,
regardless of the namespace or source assembly of the interface. For fact attributes,
serves this purpose, but this is generally
found by convention rather than type to prevent 3rd party libraries from needing to
take an explicit reference to xUnit.net binaries.
Indicates the parallelization algorithm to use.
The conservative parallelization algorithm uses a semaphore to limit the number of started tests to be equal
to the desired parallel thread count. This has the effect of allowing tests that have started to finish faster,
since there are no extra tests competing for a chance to run, at the expense that CPU utilization will be lowered
if the test project spawns a lot of async tests that have significant wait times.
The aggressive parallelization algorithm uses a synchronization context to limit the number of running tests
to be equal to the desired parallel thread count. This has the effect of being able to use the CPU more
effectively since there are typically most tests capable of running than there are CPU cores, at the
expense of tests that have already started being put into the back of a long queue before they can run
again.
Extension methods for
Determines if the value is a valid enum value.
Represents an attachment to a test result.
Called by the de-serializer; should only be called by deriving classes for de-serialization purposes
Gets the type of the test attachment.
Gets the attachment content as a byte array, along with the media type. Can only be called
when returns .
Gets the attachment content as a string. Can only be called when
returns .
Creates an instance of that wraps a byte array value.
The byte array value
The media type
The value must be in the MIME "type/subtype" form, and does not support
parameter values. The subtype is allowed to have a single "+" to denote specialization of the
subtype (i.e., "application/xhtml+xml"). For more information on media types, see
.
Creates an instance of that wraps a string value.
Parses a value that was obtained by calling back into a .
Gets a string value for the test attachment. For string value attachments, will return the string value;
for byte array values, it will return the base-64 encoded value of the bytes.
Gets the type of the test attachment
Indicates a test attachment that is a string.
Indicates a test attachment that is an array of bytes.
Indicates the default display name format for test methods.
Use a fully qualified name (namespace + class + method)
Use just the method name (without class)
Extension methods for
Determines if the value is a valid enum value.
Indicates the method display options for test methods.
Indicates no additional method display options.
This is the default configuration option.
Replace underscores in display names with a space.
Replace well-known monikers with their equivalent operator.
- lt becomes <
- le becomes <=
- eq becomes =
- ne becomes !=
- gt becomes >
- ge becomes >=
Replace supported escape sequences with their equivalent character.
Encoding
Format
- ASCIIX hex-digit hex-digit (ex: X2C)
- UnicodeU hex-digit hex-digit hex-digit hex-digit (ex: U00A9)
Replaces the period delimiter used in namespace and type references with a comma.
This option is only honored if the setting is also enabled.
Enables all method display options.
Extension methods for
Determines if the value is a valid enum value.
Used to decorate xUnit.net test assemblies to register an external serializer for
one or more supports types to serialize.
The type of the serializer. Must implement .
The types that are supported by the serializer.
Used to decorate xUnit.net test assemblies to register an external serializer for
one or more supports types to serialize.
The type of the serializer. Must implement .
The types that are supported by the serializer.
Serializes and de-serializes objects. It supports a limited set of built-in types,
as well as anything which implements . Custom serializers
can implement and register by decorating the test
assembly with .
Initializes a new instance of the class.
Gets the singleton instance of .
Add serializers that have been registered in the given assembly.
The assembly to get registrations from
An optional collection to receive warnings generated during the registration
The warnings collection will include warnings in the following circumstances:
* When the serializer type that does not implement
* When the registration contains no support types to serialize
* When a supported type to serialize is duplicated with another serializer
* When a supported type is covered by a built-in serializer
* An exception is thrown while creating the serializer
Add serializers to the supported serializer list.
The serialization registrations
An optional collection to receive warnings generated during the registration
The warnings collection will include warnings in the following circumstances:
* When the serializer type that does not implement
* When the registration contains no support types to serialize
* When a supported type to serialize is duplicated with another serializer
* When a supported type is covered by a built-in serializer
* An exception is thrown while creating the serializer
De-serializes an object.
The type of the object
The object's serialized value
The de-serialized object
De-serializes an object.
The serialized value
The de-serialized object
Determines if an object instance is serializable.
The object to test for serializability.
Returns true if the object can be serialized; false, otherwise.
As null values always return true, even if the underlying type (which is unknown)
might not be serializable, it's better to test via
whenever possible.
Determines if a given type supports serialization.
The object to test for serializability.
The type to test for serializability.
Returns true if objects of the given type can be serialized; false, otherwise.
THIS METHOD IS FOR INTERNAL PURPOSES ONLY. DO NOT CALL.
Serializes an object.
The value to be serialized
The type of the value to be serialized (cannot be null if is null)
The serialized object
Converts a type name (in "TypeName" format for mscorlib types, or "TypeName,AssemblyName" format for
all others) into a object.
The assembly qualified type name ("TypeName,AssemblyName")
The instance of the , if available; null, otherwise.
Gets an assembly qualified type name for serialization.
The type to get the name for
A string in "TypeName" format (for mscorlib types) or "TypeName,AssemblyName" format (for all others)
Represents serialization information for serializing a complex object. This is typically
used by objects which implement .
Initializes a new instance of the class
for the purposes of serialization (starting empty).
The serialization helper
Initializes a new instance of the class
for the purposes of serialization (starting populated by the given object).
The data to copy into the serialization info
The serialization helper
Initializes a new instance of the class
for the purposes of deserialization.
The serialization helper
The serialized value to copy into the serialization info
Returns a string that represents the entirety of the data.
Extension methods for .
Adds a value to the serialization. Supported value types include the built-in
intrinsics (string, int, long, float, double, and decimal, including nullable
versions of those), any class which implements ),
or arrays of any supported types.
The key to store the value with
The value to be stored
Gets a strongly-typed value from the serialization.
The type of the value
The key of the value to retrieve
The value, if present; default(T), otherwise
A utility class for ANSI color escape codes.
Gets a regular expression that can used to find ANSI color escape codes.
Strip ANSI color escape codes (in the form of ESC[1;2m) from a string value.
The message that may contain ANSI color escape codes
The message without the ANSI color escape codes
Utility class for dealing with asynchronous operations.
Determines if the given method is async, as matters to xUnit.net. This means it either (a) returns
a or ; or, (b) it is an F# function which was declared as
async. Note that this is not the same thing as an "awaitable" method, since xUnit.net does not
recreate the compiler's await machinery at runtime.
The method to test
Returns true if the method is async; returns false otherwise.
Determines if the given method is async void by looking for the
and return type on the method definition.
The method to test
Returns true if the method is async void; returns false otherwise.
Given an object, will attempt to convert instances of or
into
as appropriate. Will return null if the object is not a task of any supported type.
Note that this list of supported tasks is purposefully identical to the list used
by .
The object to convert
Returns a for the given object, if it's compatible;
returns null otherwise.
Tracks disposable objects, and disposes them in the reverse order they were added to
the tracker. Supports both and .
You can either directly dispose this object (via ), or you
can enumerate the items contained inside of it (via ).
Also supports hand-registering disposal actions via
and . Note that an object implements both interfaces,
this will *only* call and will not
call .
Gets a list of the items that are currently being tracked.
Add an object to be disposed. It may optionally support
and/or .
The object to be disposed.
Add an action to the list of things to be done during disposal.
The cleanup action.
Add an action to the list of things to be done during disposal.
The cleanup action.
Add a collection of objects to be disposed. They may optionally support
and/or .
The objects to be disposed.
Removes all objects from the disposal tracker.
Disposes all the objects that were added to the disposal tracker, in the reverse order
of which they were added. For any object which implements both
and we will favor
and not call .
Utility class for dealing with and objects.
Combines multiple levels of messages into a single message.
The error metadata from which to get the messages.
The combined string.
Combines multiple levels of stack traces into a single stack trace.
The error metadata from which to get the stack traces.
The combined string.
Unwraps exceptions and their inner exceptions.
The exception to be converted.
The error metadata.
An implementation of that ignores all messages.
Gets the singleton null message sink instance.
Wraps to provide access to the seed value, as well as
the ability to reset the current randomizer with a new seed value.
Gets the current instance that returns random values based on the
current value.
Gets the seed used to create the randomizer.
Utility methods related to .
Converts an argument into its target type. Can be particularly useful when pulling attribute
constructor arguments, whose types may not strictly match the parameter type.
The argument to be converted.
The target type for the conversion.
The converted argument.
Converts arguments into their target types. Can be particularly useful when pulling attribute
constructor arguments, whose types may not strictly match the parameter types.
The arguments to be converted.
The target types for the conversion.
The converted arguments.
Converts an argument collection from an attribute initializer into an array of the raw values.
The attribute argument collection.
The element type of the array.
The collection of the raw attribute values.
Converts an assembly qualified type name from back into
a object.
The assembly qualified type name.
The instance of the , if available; null, otherwise.
Converts an assembly name + type name into a object.
The assembly name.
The type name.
The instance of the , if available; null, otherwise.
Gets an assembly-qualified type name suitable for serialization.
The type value
A string in "TypeName" format (for mscorlib types) or "TypeName,AssemblyName" format (for all others)
Dynamic types, or types which live in the GAC, are not supported.
Converts an assembly qualified type name into a object. If the
type does not exist, throws an .
The assembly qualified type name.
The instance of the .
Generates unique IDs from multiple string inputs. Used to compute the unique
IDs that are used inside the test framework.
Initializes a new instance of the class.
Add a string value into the unique ID computation.
The value to be added to the unique ID computation
Compute the unique ID for the given input values. Note that once the unique
ID has been computed, no further operations will be allowed.
The computed unique ID
Computes a unique ID for a test assembly.
The assembly path
The optional configuration file path
The computed unique ID for the assembly
Computes a unique ID for a test.
The unique ID of the test case that this test belongs to.
The index of this test in the test case, typically starting with 0
(though a negative number may be used to prevent collisions with legitimate test indices).
Computes a unique ID for a test case.
The unique ID of the parent in the hierarchy; typically the test method
unique ID, but may also be the test class or test collection unique ID, when test method (and
possibly test class) don't exist.
The test method's generic types
The test method's arguments
The computed unique ID for the test case
Computes a unique ID for a test class.
The unique ID of the parent test collection for the test class
The optional fully qualified type name of the test class
The computed unique ID for the test class (may return null if
is null)
Computes a unique ID for a test collection.
The unique ID of the assembly the test collection lives in
The display name of the test collection
The optional class name that contains the test collection definition
The computed unique ID for the test collection
Computes a unique ID for a test method.
The unique ID of the parent test class for the test method
The optional test method name
The computed unique ID for the test method (may return null if either the class
unique ID or the method name is null)
Computes a unique ID for a .
The type to generate an ID for
An exception which indicates an object had several properties that were not properly initialized.
The properties that were not set
The type that the property belongs to
An exception which indicates an object had several properties that were not properly initialized.
The properties that were not set
The type that the property belongs to
Gets the property names of the uninitialized properties.
Gets the type name of the uninitialized property.
An exception which indicates an object was not properly initialized, thrown by a property
getter that was accessed by the uninitialized object.
The property that was not set
The type that the property belongs to
An exception which indicates an object was not properly initialized, thrown by a property
getter that was accessed by the uninitialized object.
The property that was not set
The type that the property belongs to
Gets the property name of the uninitialized property.
Gets the type name of the uninitialized property.
INTERNAL CLASS. DO NOT USE.
Gets the value for an unknown target framework.
Safely gets the code base of an assembly.
The assembly.
If the assembly is null, or is dynamic, then it returns null; otherwise, it returns the value
from .
Safely gets the location of an assembly.
The assembly.
If the assembly is null, or is dynamic, then it returns null; otherwise, it returns the value
from .
Gets the target framework name for the given assembly.
The assembly.
The target framework (typically in a format like ".NETFramework,Version=v4.7.2"
or ".NETCoreApp,Version=v6.0"). If the target framework type is unknown (missing file,
missing attribute, etc.) then returns "UnknownTargetFramework".
INTERNAL CLASS. DO NOT USE.
INTERNAL CLASS. DO NOT USE.
Returns as an array of , using a cast when
available and when not.
Returns as a , using a cast when
available and when not.
Returns as an of ,
using a cast when available and when not.
Returns as an of ,
using a cast when available and when not.
Enumerates all values in a collection, calling the callback for each.
Returns as an enumerable of with
all the null items removed.
Returns as an enumerable of with
all the null items removed.
Returns with all the null or whitespace-only strings removed.
INTERNAL CLASS. DO NOT USE.
INTERNAL CLASS. DO NOT USE.
Unwraps an exception to remove any wrappers, like .
The exception to unwrap.
The unwrapped exception.
Helper class for guarding value arguments and valid state.
Ensures that an enum value is valid by comparing against a list of valid values.
The argument type
The value of the argument
The list of valid values
The name of the argument
Ensures that a nullable value type argument is not null.
The argument type
The value of the argument
The name of the argument
The argument value as a non-null value
Thrown when the argument is null
Ensures that a nullable reference type argument is not null.
The argument type
The value of the argument
The name of the argument
The argument value as a non-null value
Thrown when the argument is null
Ensures that a nullable reference type argument is not null.
The argument type
The exception message to use when the argument is null
The value of the argument
The name of the argument
The argument value as a non-null value
Thrown when the argument is null
Ensures that a nullable reference type argument is not null.
The argument type
The creator for an exception message to use when the argument is null
The value of the argument
The name of the argument
The argument value as a non-null value
Thrown when the argument is null
Ensures that a nullable enumerable type argument is not null or empty.
The argument type
The value of the argument
The name of the argument
The argument value as a non-null, non-empty value
Thrown when the argument is null or empty
Ensures that a nullable enumerable type argument is not null or empty.
The argument type
The exception message to use when the argument is null or empty
The value of the argument
The name of the argument
The argument value as a non-null, non-empty value
Thrown when the argument is null or empty
Ensures that a nullable enumerable type argument is not null or empty.
The argument type
The creator for an exception message to use when the argument is null or empty
The value of the argument
The name of the argument
The argument value as a non-null, non-empty value
Thrown when the argument is null or empty
Ensures that an argument is valid.
The exception message to use when the argument is not valid
The validity test value
The name of the argument
The argument value as a non-null value
Thrown when the argument is not valid
Ensures that an argument is valid.
The creator for an exception message to use when the argument is not valid
The validity test value
The name of the argument
The argument value as a non-null value
Thrown when the argument is not valid
Ensures that a filename argument is not null or empty, and that the file exists on disk.
The file name value
The name of the argument
The file name as a non-null value
Thrown when the argument is null, empty, or not on disk
Ensures that a value is not default value. This is used for values of generic types
where nullability is not known.
The argument type
The value of the argument
The name of the argument
The argument value as a non-default value
Thrown when the argument is default
Ensure that a reference value is not null.
The value type
The exception message to use when the value is not valid
The value to test for null
The value as a non-null value
Thrown when the value is not valid
Ensure that a reference value is not null.
The value type
The creator for an exception message to use when the value is not valid
The value to test for null
The value as a non-null value
Thrown when the value is not valid
Ensure that a nullable struct value is not null.
The value type
The exception message to use when the value is not valid
The value to test for null
The value as a non-null value
Thrown when the value is not valid
Ensure that a nullable struct value is not null.
The value type
The creator for an exception message to use when the value is not valid
The value to test for null
The value as a non-null value
Thrown when the value is not valid
INTERNAL CLASS. DO NOT USE.
INTERNAL CLASS. DO NOT USE.
Formats value for display in assertion messages and data-driven test display names.
Gets the ellipsis value (three middle dots, aka U+00B7).
Gets the maximum number of values printed for collections before truncation.
Gets the maximum printing depth, in terms of objects before truncation.
Gets the maximum number of items (properties or fields) printed in an object before truncation.
Gets the maximum strength length before truncation.
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".
The string value to be escaped
Formats a value for display.
The value to be formatted
The optional printing depth (1 indicates a top-level value)
Formats a type. This maps built-in C# types to their C# native name (e.g., printing "int" instead
of "Int32" or "System.Int32").
The type to get the formatted name of
Set to true to include the namespace; set to false for just the simple type name
Specifies the priority of a member in overload resolution. When unspecified, the default priority is 0.
Initializes a new instance of the class.
The priority of the attributed member. Higher numbers are prioritized, lower numbers are deprioritized. 0 is the default if no attribute is present.
The priority of the member.
Specifies that null is allowed as an input even if the corresponding type disallows it.
Specifies that null is disallowed as an input even if the corresponding type allows it.
Specifies that an output may be null even if the corresponding type disallows it.
Specifies that an output will not be null even if the corresponding type allows it.
Specifies that when a method returns , the parameter may be null even if the corresponding type disallows it.
Initializes the attribute with the specified return value condition.
The return value condition. If the method returns this value, the associated parameter may be null.
Gets the return value condition.
Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it.
Initializes the attribute with the specified return value condition.
The return value condition. If the method returns this value, the associated parameter will not be null.
Gets the return value condition.
Specifies that the output will be non-null if the named parameter is non-null.
Initializes the attribute with the associated parameter name.
The associated parameter name. The output will be non-null if the argument to the parameter specified is non-null.
Gets the associated parameter name.
Applied to a method that will never return under any circumstance.
Specifies that the method will not return if the associated Boolean parameter is passed the specified value.
Initializes the attribute with the specified parameter value.
The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to
the associated parameter matches this value.
Gets the condition parameter value.
Specifies the syntax used in a string.
Initializes the with the identifier of the syntax used.
The syntax identifier.
Initializes the with the identifier of the syntax used.
The syntax identifier.
Optional arguments associated with the specific syntax employed.
Gets the identifier of the syntax used.
Optional arguments associated with the specific syntax employed.
The syntax identifier for strings containing composite formats for string formatting.
The syntax identifier for strings containing date format specifiers.
The syntax identifier for strings containing date and time format specifiers.
The syntax identifier for strings containing format specifiers.
The syntax identifier for strings containing format specifiers.
The syntax identifier for strings containing JavaScript Object Notation (JSON).
The syntax identifier for strings containing numeric format specifiers.
The syntax identifier for strings containing regular expressions.
The syntax identifier for strings containing time format specifiers.
The syntax identifier for strings containing format specifiers.
The syntax identifier for strings containing URIs.
The syntax identifier for strings containing XML.