nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #00182
[Bug 465416] Re: using TestCase attribute with arrays doesn't produce helpful output
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)
public void MyTest(
[Values(2,1,1.1)] double price ) { ... }
** Changed in: nunit-3.0
Status: New => Invalid
** Converted to question:
https://answers.launchpad.net/nunit-3.0/+question/87575
--
using TestCase attribute with arrays doesn't produce helpful output
https://bugs.launchpad.net/bugs/465416
You received this bug notification because you are a member of NUnit
Core Developers, which is the registrant for NUnit Framework.
Status in NUnit Test Framework: Invalid
Bug description:
If i have the following:
[Test]
[TestCase(new[]{2,1,2.1})]
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.Tests.SampleTests.WithArray(System.Double[]{2,1,2.1})'
failed: TearDown : NUnit.Framework.AssertionException :
Expected: 0.1m
But was: 1.1m
instead of:
TestCase 'NUnitBugs.Tests.SampleTests.WithArray(System.Double[])'
failed: TearDown : NUnit.Framework.AssertionException :
Expected: 0.1m
But was: 1.1m
thanks
cliff
References