Table of Contents

Class ThrowsException

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

Exception thrown when Assert.Throws fails.

public class ThrowsException : XunitException, ISerializable, IAssertionException
Inheritance
ThrowsException
Implements
Inherited Members

Methods

ForIncorrectExceptionType(Type, Exception)

Creates a new instance of the ThrowsException class to be thrown when an exception of the wrong type was thrown by Assert.Throws.

public static ThrowsException ForIncorrectExceptionType(Type expected, Exception actual)

Parameters

expected Type

The expected exception type

actual Exception

The actual exception

Returns

ThrowsException

ForIncorrectParameterName(Type, string?, string?)

Creates a new instance of the ThrowsException class to be thrown when an ArgumentException is thrown with the wrong parameter name.

public static ThrowsException ForIncorrectParameterName(Type expected, string? expectedParamName, string? actualParamName)

Parameters

expected Type

The exception type

expectedParamName string

The expected parameter name

actualParamName string

The actual parameter name

Returns

ThrowsException

ForNoException(Type)

Creates a new instance of the ThrowsException class to be thrown when an exception wasn't thrown by Assert.Throws.

public static ThrowsException ForNoException(Type expected)

Parameters

expected Type

The expected exception type

Returns

ThrowsException