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

BeforeTestActionCommand

TestActionBeforeCommand handles the BeforeTest method of a single TestActionItem, relying on the item to remember it has been run.
using System.Runtime.CompilerServices; namespace NUnit.Framework.Internal.Commands { public class BeforeTestActionCommand : BeforeTestCommand { [System.Runtime.CompilerServices.NullableContext(1)] public BeforeTestActionCommand(TestCommand innerCommand, TestActionItem action) : base(innerCommand) { Guard.ArgumentValid(innerCommand.Test is TestSuite, "TestActionBeforeCommand may only apply to a TestSuite", "innerCommand"); Guard.ArgumentNotNull(action, "action"); BeforeTest = delegate { action.BeforeTest(base.Test); }; } } }