<PackageReference Include="NUnit" Version="4.2.1" />

ExceptionNotThrownConstraint

using System; using System.Runtime.CompilerServices; namespace NUnit.Framework.Constraints { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] internal class ExceptionNotThrownConstraint : Constraint { public override string Description => "No Exception to be thrown"; public override ConstraintResult ApplyTo<[System.Runtime.CompilerServices.Nullable(2)] TActual>(TActual actual) { Exception ex = actual as Exception; return new ConstraintResult(this, ex, ex == null); } public ExceptionNotThrownConstraint() : base(Array.Empty<object>()) { } } }