Reputation: 411
I have an NUnit test in VS2019 using .Net Core 3.1 with a TestCaseSource that supplies a list of 3-Tuples.
It works as expected and the cases I wish to test are discovered and run.
However, the Test Explorer shows the same Test method as a test without source. The result is the "test" is skipped and the results for the group show as inconclusive. Here are the code and Test Explorer image:
public static IEnumerable<(int, int, int)[]> TestInput
{
get
{
yield return new[] {
(0, 2, 3),
(0, 1, 7),
...
[Test]
[TestCaseSource(nameof(TestInput))]
public void CalcTotalTime_Given_known_valid_input_Then_returns_expected_result((int,int,int)[] input)
{
...
Since this is just a learning project the code under test is in the test project, so there is only one project and it targets .NET Core 3.1.
The installed NuGet packages are:
Upvotes: 0
Views: 525
Reputation: 1111
I was able to reproduce it and it seems like a bug to me with the NUnit3TestAdapter. Similar issues were found in the past: https://github.com/nunit/nunit3-vs-adapter/issues/559
Depending on what you're trying to achieve, you can consider writing your unit test like this:
[TestCase(0,2,3)]
[TestCase(1,2,3)]
public void CalcTotalTime_Given_known_valid_input_Then_returns_expected_result(int a, int b, int c)
{
}
But as mentioned in the comment, the behavior is not identical to the original code.
Upvotes: 0