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

TestCaseData

The TestCaseData class represents a set of arguments and other parameter info to be used for a parameterized test case. It is derived from TestCaseParameters and adds a fluent syntax for use in initializing the test case.
using NUnit.Framework.Interfaces; using NUnit.Framework.Internal; using System.Runtime.CompilerServices; namespace NUnit.Framework { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public class TestCaseData : TestCaseParameters { [System.Runtime.CompilerServices.NullableContext(2)] public TestCaseData(params object[] args) : base(args ?? new object[1]) { } [System.Runtime.CompilerServices.NullableContext(2)] public TestCaseData(object arg) : base(new object[1] { arg }) { } [System.Runtime.CompilerServices.NullableContext(2)] public TestCaseData(object arg1, object arg2) : base(new object[2] { arg1, arg2 }) { } [System.Runtime.CompilerServices.NullableContext(2)] public TestCaseData(object arg1, object arg2, object arg3) : base(new object[3] { arg1, arg2, arg3 }) { } public TestCaseData Returns([System.Runtime.CompilerServices.Nullable(2)] object result) { base.ExpectedResult = result; return this; } public TestCaseData SetName([System.Runtime.CompilerServices.Nullable(2)] string name) { base.TestName = name; return this; } public TestCaseData SetArgDisplayNames([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] params string[] displayNames) { base.ArgDisplayNames = displayNames; return this; } public TestCaseData SetDescription(string description) { base.Properties.Set("Description", description); return this; } public TestCaseData SetCategory(string category) { base.Properties.Add("Category", category); return this; } public TestCaseData SetProperty(string propName, string propValue) { base.Properties.Add(propName, propValue); return this; } public TestCaseData SetProperty(string propName, int propValue) { base.Properties.Add(propName, propValue); return this; } public TestCaseData SetProperty(string propName, double propValue) { base.Properties.Add(propName, propValue); return this; } public TestCaseData Explicit() { base.RunState = RunState.Explicit; return this; } public TestCaseData Explicit(string reason) { base.RunState = RunState.Explicit; base.Properties.Set("_SKIPREASON", reason); return this; } public IgnoredTestCaseData Ignore(string reason) { RunState runState = base.RunState; base.RunState = RunState.Ignored; base.Properties.Set("_SKIPREASON", reason); return new IgnoredTestCaseData(this, runState); } } }