MemberData must reference a public member
This rule is triggered when your [MemberData]
attribute points to a non-public
member.
[MemberData]
attributes may only point at public
members, or else they will fail at runtime.
To fix a violation of this rule, make the data member public
visibility.
using System.Collections.Generic;
using Xunit;
public class xUnit1016
{
protected static IEnumerable<object[]> TestData;
[Theory]
[MemberData(nameof(TestData))]
public void TestMethod(string greeting, int age) { }
}
using System.Collections.Generic;
using Xunit;
public class xUnit1016
{
public static IEnumerable<object[]> TestData;
[Theory]
[MemberData(nameof(TestData))]
public void TestMethod(string greeting, int age) { }
}