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

StaticMethodValidator

Checks whether the method to execute is static.
using System; using System.Reflection; using System.Runtime.CompilerServices; namespace NUnit.Framework.Internal.Execution { [NullableContext(1)] [Nullable(0)] public class StaticMethodValidator : IMethodValidator { private readonly string _failMessage; public StaticMethodValidator(string failMessage) { Guard.ArgumentNotNullOrEmpty(failMessage, "failMessage"); _failMessage = failMessage; } public void Validate(MethodInfo method) { if (!method.IsStatic) throw new InvalidOperationException(_failMessage); } } }