public static ITestDataProvider FromFieldInfo(FieldInfo field) { if (field == null) { throw new ArgumentNullException(nameof(field)); } var accessor = MemberAccessors.Field(field); return(FromMemberAccessor(accessor)); }
IEnumerable <TestData> ITestDataProvider.GetData(TestContext context) { TestUnit unit = context.TestUnit; var declaringType = ((TestTheory)unit).TestMethod.DeclaringType; var all = new List <IMemberAccessor>(); foreach (var f in _fields) { var fld = declaringType.GetField(f, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance); if (fld == null) { throw SpecFailure.CannotFindDataField(f); } all.Add(MemberAccessors.Field(fld)); } return(this.WithNames(TestDataProvider.FromMemberAccessors(all).GetData(context), _tags.TestTags)); }