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

TestParameters

public abstract class TestParameters : ITestData, IApplyToTest
TestParameters is the abstract base class for all classes that know how to provide data for constructing a test.
using NUnit.Framework.Interfaces; using System; namespace NUnit.Framework.Internal { public abstract class TestParameters : ITestData, IApplyToTest { public RunState RunState { get; set; } public object[] Arguments { get; set; } public string TestName { get; set; } public IPropertyBag Properties { get; set; } public object[] OriginalArguments { get; set; } public TestParameters() { RunState = RunState.Runnable; Properties = new PropertyBag(); } public TestParameters(object[] args) { RunState = RunState.Runnable; InitializeArguments(args); Properties = new PropertyBag(); } public TestParameters(Exception exception) { RunState = RunState.NotRunnable; Properties = new PropertyBag(); Properties.Set("_SKIPREASON", ExceptionHelper.BuildMessage(exception)); Properties.Set("_PROVIDERSTACKTRACE", ExceptionHelper.BuildStackTrace(exception)); } public TestParameters(ITestData data) { RunState = data.RunState; Properties = new PropertyBag(); TestName = data.TestName; InitializeArguments(data.Arguments); foreach (string key in data.Properties.Keys) { Properties[key] = data.Properties[key]; } } private void InitializeArguments(object[] args) { OriginalArguments = args; int num = args.Length; Arguments = new object[num]; Array.Copy(args, Arguments, num); } public void ApplyToTest(Test test) { if (RunState != RunState.Runnable) test.RunState = RunState; foreach (string key in Properties.Keys) { foreach (object item in Properties[key]) { test.Properties.Add(key, item); } } } } }