Skip to content

Commit

Permalink
Change return type for MemberData tests to IEnumerable<array> (#109090)
Browse files Browse the repository at this point in the history
The XUnitWrapperGenerator doesn't support TheoryData. This was previously accidentally
working because TheoryData was convertible to `object[]`
  • Loading branch information
agocke authored Oct 22, 2024
1 parent 4e1a15e commit a09ad52
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/tests/ilverify/TestDataLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TestDataLoader
/// [FriendlyName]_ValidType_Valid
/// </summary>
/// <returns></returns>
public static TheoryData<TestCase> GetTypesWithValidType()
public static IEnumerable<TestCase[]> GetTypesWithValidType()
{
var typeSelector = new Func<string[], TypeDefinitionHandle, TestCase>((mparams, typeDefinitionHandle) =>
{
Expand All @@ -54,7 +54,7 @@ public static TheoryData<TestCase> GetTypesWithValidType()
/// [FriendlyName]_InvalidType_[ExpectedVerifierError1]@[ExpectedVerifierError2]....[ExpectedVerifierErrorN]
/// </summary>
/// <returns></returns>
public static TheoryData<TestCase> GetTypesWithInvalidType()
public static IEnumerable<TestCase[]> GetTypesWithInvalidType()
{
var typeSelector = new Func<string[], TypeDefinitionHandle, TestCase>((mparams, typeDefinitionHandle) =>
{
Expand All @@ -74,9 +74,9 @@ public static TheoryData<TestCase> GetTypesWithInvalidType()
return GetTestTypeFromDll(typeSelector);
}

private static TheoryData<TestCase> GetTestTypeFromDll(Func<string[], TypeDefinitionHandle, TestCase> typeSelector)
private static List<TestCase[]> GetTestTypeFromDll(Func<string[], TypeDefinitionHandle, TestCase> typeSelector)
{
var retVal = new TheoryData<TestCase>();
var retVal = new List<TestCase[]>();

foreach (var testDllName in GetAllTestDlls())
{
Expand All @@ -95,7 +95,7 @@ private static TheoryData<TestCase> GetTestTypeFromDll(Func<string[], TypeDefini
newItem.TestName = mparams[0];
newItem.TypeName = typeName;
newItem.ModuleName = testDllName;
retVal.Add(newItem);
retVal.Add(new[] { newItem });
}
}
}
Expand All @@ -110,7 +110,7 @@ private static TheoryData<TestCase> GetTestTypeFromDll(Func<string[], TypeDefini
/// The word after the '_' has to be 'Valid' (Case sensitive)
/// E.g.: 'SimpleAdd_Valid'
/// </summary>
public static TheoryData<TestCase> GetMethodsWithValidIL()
public static IEnumerable<TestCase[]> GetMethodsWithValidIL()
{
var methodSelector = new Func<string[], MethodDefinitionHandle, TestCase>((mparams, methodHandle) =>
{
Expand All @@ -132,7 +132,7 @@ public static TheoryData<TestCase> GetMethodsWithValidIL()
/// 3. part: the expected VerifierErrors as string separated by '.'.
/// E.g.: SimpleAdd_Invalid_ExpectedNumericType
/// </summary>
public static TheoryData<TestCase> GetMethodsWithInvalidIL()
public static IEnumerable<TestCase[]> GetMethodsWithInvalidIL()
{
var methodSelector = new Func<string[], MethodDefinitionHandle, TestCase>((mparams, methodHandle) =>
{
Expand Down Expand Up @@ -163,9 +163,9 @@ public static TheoryData<TestCase> GetMethodsWithInvalidIL()
return GetTestMethodsFromDll(methodSelector);
}

private static TheoryData<TestCase> GetTestMethodsFromDll(Func<string[], MethodDefinitionHandle, TestCase> methodSelector)
private static List<TestCase[]> GetTestMethodsFromDll(Func<string[], MethodDefinitionHandle, TestCase> methodSelector)
{
var retVal = new TheoryData<TestCase>();
var retVal = new List<TestCase[]>();

foreach (var testDllName in GetAllTestDlls())
{
Expand Down Expand Up @@ -206,7 +206,7 @@ private static TheoryData<TestCase> GetTestMethodsFromDll(Func<string[], MethodD
newItem.MethodName = methodName;
newItem.ModuleName = testDllName;

retVal.Add(newItem);
retVal.Add(new[] { newItem });
}
}
}
Expand Down

0 comments on commit a09ad52

Please sign in to comment.