using TestCase attribute with arrays doesn't produce helpful output
This bug report was converted into a question: question #87575: using TestCase attribute with arrays doesn't produce helpful output.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
NUnit Framework |
Invalid
|
Undecided
|
Unassigned |
Bug Description
If i have the following:
[Test]
public void WithArray(params double [] prices)
{
}
It would be nice if NUnit could loop through the array and output it's contents and produce something like the following:
TestCase 'NUnitBugs.
failed: TearDown : NUnit.Framework
Expected: 0.1m
But was: 1.1m
instead of:
TestCase 'NUnitBugs.
failed: TearDown : NUnit.Framework
Expected: 0.1m
But was: 1.1m
thanks
cliff
I converted this to a question because it seems like you may have misunderstood how to use TestCase. Of course, we can reinstate the bug if I misunderstood what you want.
If you make the argument to your test method an array, then NUnit will pass the array to it. OTOH, if you want NUnit to call your method multiple times with different arguments, you should use double as the arg type and either have multiple TestCase attributes(1) or use a ValuesAttribute on the parameter(2)
(1)
[TestCase(2)]
[TestCase(1)]
[TestCase(1.1)]
public void MyTest(double price) { ... }
(2) 2,1,1.1) ] double price ) { ... }
public void MyTest(
[Values(