ReSharper 2024.3 ヘルプ

コード検査: NUnit。テストケースソースは、フィールド、プロパティ、メソッドである必要があります。

NUnit の TestCaseSource(英語) および ValueSource(英語) 属性は、データソースメンバーが静的フィールド、プロパティ、メソッドであることを必要とします。

[TestFixture] public sealed class TestCaseSourceTest { static IEnumerable<int> _fieldSource = new[] {1, 2, 3}; static IEnumerable<int> PropertySource => new[] {4, 5, 6}; static IEnumerable<int> MethodSource() => new[] {7, 8, 9}; public event UnhandledExceptionEventHandler OnError { add => throw new NotImplementedException(); remove => throw new NotImplementedException(); } [TestCaseSource(nameof(_fieldSource))] // ok [TestCaseSource(nameof(PropertySource))] // ok [TestCaseSource(nameof(MethodSource))] // ok [TestCaseSource(nameof(OnError))] // Warning: expected field/property/method public void Test1(int x) { Console.WriteLine(x); } }