<PackageReference Include="NUnit" Version="5.0.0-beta.1" />

NUnit.Framework.Throws

public abstract class Throws
Helper class with properties and methods that supply constraints that operate on exceptions.
namespace NUnit.Framework { public abstract class Throws { public static ResolvableConstraintExpression Exception { get; } public static ResolvableConstraintExpression InnerException { get; } public static ExactTypeConstraint<TargetInvocationException> TargetInvocationException { get; } public static ExactTypeConstraint<ArgumentException> ArgumentException { get; } public static ExactTypeConstraint<ArgumentNullException> ArgumentNullException { get; } public static ExactTypeConstraint<InvalidOperationException> InvalidOperationException { get; } public static ThrowsNothingConstraint Nothing { get; } public static ExactTypeConstraint TypeOf(Type expectedType); public static ExactTypeConstraint<TExpected> TypeOf<[System.Runtime.CompilerServices.Nullable(0)] TExpected>() where TExpected : Exception; public static InstanceOfTypeConstraint InstanceOf(Type expectedType); public static InstanceOfTypeConstraint<TExpected> InstanceOf<[System.Runtime.CompilerServices.Nullable(0)] TExpected>() where TExpected : Exception; protected Throws(); } }