Skip to content

Commit

Permalink
Improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Dec 30, 2024
1 parent 2658a4b commit 739bc34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Xunit.Combinatorial/CombinatorialClassDataAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public CombinatorialClassDataAttribute(Type valuesSourceType, params object[]? a
if (!typeof(IEnumerable<object[]>).IsAssignableFrom(valuesSourceType))
{
throw new InvalidOperationException(
$"The values source must be assignable to {typeof(IEnumerable<object?[]>)}).");
$"The values source {valuesSourceType} must be assignable to {typeof(IEnumerable<object?[]>)}).");
}

IEnumerable<object[]>? values;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Collections;
using Xunit;

public class CombinatorialClassDataAttributeTests
public class CombinatorialClassDataAttributeTests(ITestOutputHelper logger)
{
private static readonly object?[] ExpectedItems =
{
Expand All @@ -24,6 +24,7 @@ public void Ctor_TheoryData_MissingClassDataArguments_Throws()
{
Action ctor = () => new CombinatorialClassDataAttribute(typeof(MyTheoryDataValuesSourceWithParameters));
InvalidOperationException exception = Assert.Throws<InvalidOperationException>(ctor);
logger.WriteLine(exception.Message);
Assert.Equal(
$"Failed to create an instance of {typeof(MyTheoryDataValuesSourceWithParameters)}. " +
"Please make sure the type has a public constructor and the arguments match.",
Expand Down

0 comments on commit 739bc34

Please sign in to comment.