Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion TUnit.Core/Attributes/TestData/ArgumentsAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,14 @@ public sealed class ArgumentsAttribute : Attribute, IDataSourceAttribute, ITestR

public ArgumentsAttribute(params object?[]? values)
{
if (values == null || values.Length == 0)
if (values == null)
{
Values = [null];
}
else if (values.Length == 0)
{
Values = [];
}
else
{
Values = values;
Expand Down
11 changes: 11 additions & 0 deletions TUnit.TestProject/ParamsArgumentsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ public async Task EmptyParamsArray(string name, params Type[] types)
await Assert.That(types.Length).IsEqualTo(0);
}

[Test]
[Arguments]
[Arguments("a")]
[Arguments("a", "b")]
[Arguments("a", "b", "c")]
public async Task ParamsOnlyWithEmptyArguments(params string[] args)
{
// When [Arguments] has no values, params should be an empty array, not null
await Assert.That(args).IsNotNull();
}

[Test]
[Arguments(1, "single")]
public async Task SingleStringInParamsArray(int id, params string[] values)
Expand Down
Loading