JetBrains Rider 2024.1 Help

Code Inspection: NUnit. Test case source must be static

Category

NUnit

ID

NUnit.TestCaseSourceMustBeStatic

EditorConfig

resharper_n_unit_test_case_source_must_be_static_highlighting

Default severity

Warning

Language

C#

Requires SWA

No

Starting from NUnit 3.x, the TestCaseSource or ValueSource attribute argument representing the name of the source must refer to the static field, property or method. For example:

public class MyTestClass { [TestCaseSource("DivideCases")] public void DivideTest(int n, int d, int q) { Assert.AreEqual(q, n / d); } static object[] DivideCases = { new object[] { 12, 3, 4 }, new object[] { 12, 2, 6 }, new object[] { 12, 4, 3 } }; }
Last modified: 17 April 2024