public override IEnumerable <object[]> GetData(MethodInfo testMethod) { var package = new ExcelDataReader(FilePath, SheetName); if (DataType == null) { return(package.GetData().Select(s => new object[] { s })); } var genericGetDataMethod = package.GetType().GetMethods() .First(m => m.Name == nameof(ExcelDataReader.GetData) && m.IsGenericMethod); var getDataMethod = genericGetDataMethod.MakeGenericMethod(new Type[] { DataType }); return(((IEnumerable <object>)getDataMethod.Invoke(package, null)).Select(s => new object[] { s })); }
private IEnumerable <TestCaseParameters> GetTestCasesFor(IMethodInfo method) { var package = new ExcelDataReader(FilePath, SheetName); if (DataType == null) { return(package.GetData().Select(s => new TestCaseParameters(new object[] { s }))); } var getDataMethod = package.GetType().GetMethods() .First(m => m.Name == nameof(ExcelDataReader.GetData) && m.IsGenericMethod); var getData = getDataMethod.MakeGenericMethod(new Type[] { DataType }); return(((IEnumerable <object>)getData.Invoke(package, null)).Select(s => new TestCaseParameters(new object[] { s }))); }