Namespace Xunit.Sdk
Classes
- AllException
Exception thrown when Assert.All fails.
- AnsiUtility
A utility class for ANSI color escape codes.
- ArgumentFormatter
Formats value for display in assertion messages and data-driven test display names.
- AsyncUtility
Utility class for dealing with asynchronous operations.
- CollectionException
Exception thrown when Assert.Collection fails.
- CollectionTracker
Base class for generic CollectionTracker<T>, which also includes some public static functionality.
- CollectionTrackerExtensions
Extension methods related to CollectionTracker<T>.
- CollectionTracker<T>
A utility class that can be used to wrap enumerables to prevent double enumeration. It offers the ability to safely print parts of the collection when failures are encountered, as well as some static versions of the printing functionality.
- ContainsException
Exception thrown when Assert.Contains fails.
- DisposalTracker
Tracks disposable objects, and disposes them in the reverse order they were added to the tracker. Supports both IDisposable and IAsyncDisposable. You can either directly dispose this object (via DisposeAsync()), or you can enumerate the items contained inside of it (via TrackedObjects). Also supports hand-registering disposal actions via AddAction(Action) and AddAsyncAction(Func<ValueTask>). Note that an object implements both interfaces, this will only call DisposeAsync() and will not call Dispose().
- DistinctException
Exception thrown when Assert.Distinct fails.
- DoesNotContainException
Exception thrown when Assert.DoesNotContain fails.
- DoesNotMatchException
Exception thrown when Assert.DoesNotMatch fails.
- EmptyException
Exception thrown when Assert.Empty fails.
- EndsWithException
Exception thrown when Assert.EndsWith fails.
- EqualException
Exception thrown when Assert.Equal fails.
- EquivalentException
Exception thrown when Assert.Equivalent fails.
- ExceptionUtility
Utility class for dealing with Exception and IErrorMetadata objects.
- FailException
Exception thrown when Assert.Fail is called.
- FalseException
Exception thrown when Assert.False fails.
- IAssemblyMetadataExtensions
Extension methods for IAssemblyMetadata.
- InRangeException
Exception thrown when Assert.InRange fails.
- IsAssignableFromException
Exception thrown when Assert.IsAssignableFrom fails.
- IsNotAssignableFromException
Exception thrown when Assert.IsNotAssignableFrom fails.
- IsNotTypeException
Exception thrown when Assert.IsNotType fails.
- IsTypeException
Exception thrown when Assert.IsType fails.
- JsonArraySerializer
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).
- JsonDeserializer
A special-purpose untyped deserializer for JSON. JSON strings are returned as string, JSON numbers are returned as decimal, JSON booleans are returns as bool, JSON objects are returned as
IReadOnlyDictionary<string, object?>, JSON arrays are returned asobject?[], and JSON null values are returned asnull. Static methods exist here to help retrieve values from object dictionaries as well as convert to the commonly supported data types (bool, DateTimeOffset, decimal, Enum, int, long, string, and trait dictionaries (which are decoded toIReadOnlyDictionary<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 Enum and DateTimeOffset values are handled here).
- JsonObjectSerializer
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).
- JsonSerializerBase
Base class used for streaming JSON serialization.
- JsonSerializerExtensions
Extension methods for the JSON serialization types.
- JsonTypeIDAttribute
Used to decorate concrete serializable classes that implement IMessageSinkMessage 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.
- LongLivedMarshalByRefObject
Base class for all long-lived objects that may cross over an AppDomain.
- MatchesException
Exception thrown when Assert.Matches fails.
- MessageSinkMessageExtensions
Extension methods for IMessageSinkMessage.
- MultipleException
Exception thrown when Assert.Multiple fails w/ multiple errors (when a single error occurs, it is thrown directly).
- NotEmptyException
Exception thrown when Assert.NotEmpty fails.
- NotEqualException
Exception thrown when Assert.NotEqual fails.
- NotInRangeException
Exception thrown when Assert.NotInRange fails.
- NotNullException
Exception thrown when Assert.NotNull fails.
- NotSameException
Exception thrown when Assert.NotSame fails.
- NotStrictEqualException
Exception thrown when Assert.NotStrictEqual fails.
- NullException
Exception thrown when Assert.Null fails.
- NullMessageSink
An implementation of IMessageSink that ignores all messages.
- ProperSubsetException
Exception thrown when Assert.ProperSubset fails.
- ProperSupersetException
Exception thrown when Assert.ProperSuperset fails.
- PropertyChangedException
Exception thrown when Assert.PropertyChanged fails.
- RaisesAnyException
Exception thrown when Assert.RaisesAny fails.
- RaisesException
Exception thrown when Assert.Raises fails.
- Randomizer
Wraps Random to provide access to the seed value, as well as the ability to reset the current randomizer with a new seed value.
- ReflectionExtensions
Extension methods for reflection types in .NET.
- RegisterXunitSerializerAttribute
Used to decorate xUnit.net test assemblies to register an external serializer for one or more supports types to serialize.
- SameException
Exception thrown when Assert.Same fails.
- SerializationHelper
Serializes and de-serializes objects. It supports a limited set of built-in types, as well as anything which implements IXunitSerializable. Custom serializers can implement IXunitSerializer and register by decorating the test assembly with RegisterXunitSerializerAttribute.
- SingleException
Exception thrown when Assert.Single fails.
- SkipException
Exception thrown when Assert.Skip is called.
- StartsWithException
Exception thrown when Assert.StartsWith fails.
- StrictEqualException
Exception thrown when Assert.StrictEqual fails.
- SubsetException
Exception thrown when Assert.Subset fails.
- SupersetException
Exception thrown when Assert.Superset fails.
- TestAttachment
Represents an attachment to a test result.
- TestFrameworkOptionsReadExtensions
Extension methods for reading ITestFrameworkDiscoveryOptions and ITestFrameworkExecutionOptions.
- TestFrameworkOptionsReadWriteExtensions
Extension methods for reading and writing ITestFrameworkDiscoveryOptions and ITestFrameworkExecutionOptions.
- TestOptionsNames
Test options names
- TestOptionsNames.Discovery
Test options names used with ITestFrameworkDiscoveryOptions.
- TestOptionsNames.Execution
Test options names used with ITestFrameworkExecutionOptions.
- TestPipelineException
Represents an exception that happened during the processing of the test pipeline. This typically means there were problems identifying the correct test class constructor, problems creating the fixture data, etc.
- TestTimeoutException
Thrown if a test exceeds the specified timeout.
- ThrowsAnyException
Exception thrown when Assert.ThrowsAny fails.
- ThrowsException
Exception thrown when Assert.Throws fails.
- TrueException
Exception thrown when Assert.True fails.
- TypeHelper
Utility methods related to Type.
- UniqueIDGenerator
Generates unique IDs from multiple string inputs. Used to compute the unique IDs that are used inside the test framework.
- UnsetPropertiesException
An exception which indicates an object had several properties that were not properly initialized.
- UnsetPropertyException
An exception which indicates an object was not properly initialized, thrown by a property getter that was accessed by the uninitialized object.
- XunitException
The base assert exception class. It marks itself with IAssertionException which is how the framework differentiates between assertion fails and general exceptions.
- XunitSerializationInfo
Represents serialization information for serializing a complex object. This is typically used by objects which implement IXunitSerializable.
- XunitSerializationInfoExtensions
Extension methods for IXunitSerializationInfo.
Interfaces
- IAfterTestFinished
This message is sent during execution to indicate that the After method of a IBeforeAfterTestAttribute just finished executing.
- IAfterTestStarting
This message is sent during execution to indicate that the After method of a IBeforeAfterTestAttribute is about to execute.
- IAssemblyMetadata
Represents metadata about a test assembly.
- IAssertionException
This is a marker interface implemented by all built-in assertion exceptions so that test failures can be marked with Assertion.
- IBeforeTestFinished
This message is sent during execution to indicate that the Before method of a IBeforeAfterTestAttribute has completed executing.
- IBeforeTestStarting
This message is sent during execution to indicate that the Before method of a IBeforeAfterTestAttribute is about to execute.
- IDiagnosticMessage
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 https://xunit.net/docs/configuration-files#diagnosticMessages on how to enable display of diagnostic messages).
- IDiscoveryComplete
This message indicates that the discovery process has been completed for the requested assembly.
- IDiscoveryStarting
This message indicates that the discovery process is starting for the requested assembly.
- IErrorMessage
This message indicates that a catastrophic error has occurred.
- IErrorMetadata
Represents metadata about an error during test discovery or execution.
- IExecutionMetadata
This is metadata describing the execution of a single test.
- IExecutionSummaryMetadata
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.
- IInternalDiagnosticMessage
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).
- IJsonDeserializable
Indicates that an object can be deserialized from string-serialized JSON.
- IJsonSerializable
Interface that indicates an object can be serialized to JSON.
- IMessageSink
Represents an endpoint for the reception of test messages.
- IMessageSinkMessage
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.
- IRegisterXunitSerializerAttribute
Used to decorate xUnit.net test assemblies to register an external serializer for one or more supports types to serialize.
- ITest
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).
- ITestAssembly
Represents a test assembly.
- ITestAssemblyCleanupFailure
This message indicates that an error has occurred during test assembly cleanup.
- ITestAssemblyFinished
This message indicates that the execution process has been completed for the requested assembly.
- ITestAssemblyMessage
Base interface for all messages related to test assemblies.
- ITestAssemblyStarting
This message indicates that the execution process is about to start for the requested assembly.
- ITestCase
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.
- ITestCaseCleanupFailure
This message indicates that an error has occurred during test case cleanup.
- ITestCaseDiscovered
This message indicates that a test case had been found during the discovery process.
- ITestCaseFinished
This message indicates that a test case has finished executing.
- ITestCaseMessage
Base interface for all messages related to test cases.
- ITestCaseMetadata
Represents metadata about a test case.
- ITestCaseStarting
This message indicates that a test case is about to start executing.
- ITestClass
Represents a test class, which contributes one or more test cases (usually by way of test methods).
- ITestClassCleanupFailure
This message indicates that an error has occurred during test class cleanup.
- ITestClassConstructionFinished
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.
- ITestClassConstructionStarting
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.
- ITestClassDisposeFinished
This message indicates that the Dispose() or DisposeAsync() method was just called on the test class for the test that just finished executing.
- ITestClassDisposeStarting
This message indicates that the Dispose() or DisposeAsync() method is about to be called on the test class for the test that just finished executing.
- ITestClassFinished
This message indicates that a test class has finished executing (meaning, all of the test cases in this test class have finished running).
- ITestClassMessage
Base interface for all messages related to test classes.
- ITestClassMetadata
Represents metadata about a test class.
- ITestClassStarting
This message indicates that a test class is about to begin executing.
- ITestCleanupFailure
This message indicates that an error has occurred during test cleanup.
- ITestCollection
Represents a group of test cases.
- ITestCollectionCleanupFailure
This message indicates that an error has occurred during test collection cleanup.
- ITestCollectionFinished
This message indicates that a test collection has just finished executing (meaning, all the test classes in the collection has finished).
- ITestCollectionMessage
Base interface for all messages related to test collections.
- ITestCollectionMetadata
Represents metadata about a test collection.
- ITestCollectionStarting
This message indicates that a test collection is about to start executing.
- ITestFailed
This message indicates that a test has failed.
- ITestFinished
This message indicates that a test has finished executing.
- ITestFrameworkDiscoveryOptions
Represents an instance of ITestFrameworkOptions that is to be used for test discovery purposes.
- ITestFrameworkExecutionOptions
Represents an instance of ITestFrameworkOptions that is to be used for test execution purposes.
- ITestFrameworkOptions
This interface should not be consumed directly; instead, you should consume ITestFrameworkDiscoveryOptions or ITestFrameworkExecutionOptions.
- ITestMessage
Base interface for all messages related to tests.
- ITestMetadata
Represents metadata about a test.
- ITestMethod
Represents a test method, which contributes one or more test cases.
- ITestMethodCleanupFailure
This message indicates that an error has occurred during test method cleanup.
- ITestMethodFinished
This message indicates that a test method has finished executing (meaning, all the test cases that derived from the test method have finished).
- ITestMethodMessage
Base interface for all messages related to test methods.
- ITestMethodMetadata
Represents metadata about a test method.
- ITestMethodStarting
This message indicates that a test method is about to begin executing.
- ITestNotRun
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).
- ITestOutput
This message indicates that a line of output was provided for a test.
- ITestPassed
Indicates that a test has passed.
- ITestResultMessage
Base interface for all individual test results (e.g., tests which pass, fail, skipped, or aren't run).
- ITestSkipped
This message indicates that a test was skipped.
- ITestStarting
This message indicates that a test is about to start executing.
- IXunitSerializable
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.
- IXunitSerializationInfo
An interface that is implemented by the serialization infrastructure in xUnit.net. This is passed to objects which implement IXunitSerializable so they can serialize and deserialize themselves from the serialization store.
- IXunitSerializer
Implemented by types which can support serialization and deserialization. This allows external serializers for types which would be inconvenient or impossible to implement IXunitSerializable directly.
Enums
- ExplicitOption
Indicates how explicit tests should be handled during execution.
- FailureCause
Indicates the cause of the test failure.
- ParallelAlgorithm
Indicates the parallelization algorithm to use.
- TestAttachmentType
Gets the type of the test attachment
- TestMethodDisplay
Indicates the default display name format for test methods.
- TestMethodDisplayOptions
Indicates the method display options for test methods.