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

ExceptionNotThrownConstraint

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