Skip to content

Commit 6ccb1b7

Browse files
fix msbuild
1 parent f58a059 commit 6ccb1b7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Testimize/Testimize.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<PackageId>Testimize</PackageId>
1010
<Configurations>Debug;Release</Configurations>
1111
<LangVersion>11.0</LangVersion>
12+
<IsPackable>true</IsPackable>
1213
</PropertyGroup>
1314

1415
<PropertyGroup>

Testimize/src/Usage/XUnit/TestimizeGeneratedTestCasesAttribute.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ public override IEnumerable<object[]> GetData(MethodInfo testMethod)
4949
if (sourceMethod == null)
5050
throw new InvalidOperationException($"Static method '{_configMethodName}' not found in {declaringType.FullName}.");
5151

52-
var testCases = (List<TestCase>)sourceMethod.Invoke(null, null);
53-
if (testCases == null)
54-
throw new InvalidOperationException($"Method '{_configMethodName}' returned null.");
52+
var result = sourceMethod.Invoke(null, null);
53+
if (result is not List<TestCase> testCases)
54+
throw new InvalidOperationException($"Method '{_configMethodName}' must return List<TestCase> but returned {result?.GetType().Name ?? "null"}.");
55+
56+
if (!testCases.Any())
57+
throw new InvalidOperationException($"Method '{_configMethodName}' returned no test cases.");
5558

5659
foreach (var testCase in testCases)
5760
{

0 commit comments

Comments
 (0)