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

DelegatingTestCommand

public abstract class DelegatingTestCommand : TestCommand
DelegatingTestCommand wraps an inner TestCommand. Derived classes may do what they like before or after running the inner command.
using System; using System.Runtime.CompilerServices; namespace NUnit.Framework.Internal.Commands { [NullableContext(1)] [Nullable(0)] public abstract class DelegatingTestCommand : TestCommand { protected TestCommand innerCommand; protected DelegatingTestCommand(TestCommand innerCommand) : base(innerCommand.Test) { this.innerCommand = innerCommand; } protected static void RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action) { try { action(); } catch (Exception ex) { context.CurrentResult.RecordException(ex); } } } }