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

TestActionCommand

TestActionCommand handles a single ITestAction applied to a test. It runs the BeforeTest method, then runs the test and finally runs the AfterTest method.
namespace NUnit.Framework.Internal.Commands { public class TestActionCommand : BeforeAndAfterTestCommand { public TestActionCommand(TestCommand innerCommand, ITestAction action) : base(innerCommand) { Guard.ArgumentValid(innerCommand.Test is TestMethod, "TestActionCommand may only apply to a TestMethod", "innerCommand"); Guard.ArgumentNotNull(action, "action"); BeforeTest = delegate { action.BeforeTest(base.Test); }; AfterTest = delegate { action.AfterTest(base.Test); }; } } }