← Back to team overview

nunit-core team mailing list archive

Re: [Bug 601645] [NEW] Parametered test should try to convert data type from source to paramter

 

NUnit already does conversions but it won't make conversions that
could result in
the truncation of values. So it will convert short to int but not int to short.

We could change that, but I'd like to see what other folks think, so
I'll forward
this request to the mailing list.

Charlie

On Sun, Jul 4, 2010 at 10:08 AM, Kenneth Xu <launchpad@xxxxxxxxxx> wrote:
> Public bug reported:
>
> This is rather a feature request. Look at below test:
>
> [TestCase(10)] public void TestMethod(short a) { }
>
> That looks quite valid at the first glance but it of cause failed. The
> right syntax is
>
> [TestCase((short)10)] public void TestMethod(short a) { }
>
> Same problem goes to float type and/or Values attribute.
>
> Would it be possible for NUnit to have the TestCase and Values
> attributes to convert the type based on the method signature?
>
> See http://groups.google.com/group/nunit-
> discuss/browse_thread/thread/22898e500f20351b/ff87c7d3169be55b?hl=en&lnk=gst&q=short+type+in+parametrized+test+%09%09%09%09#ff87c7d3169be55b
>
> ** Affects: nunitv2
>     Importance: Undecided
>         Status: New
>
>
> ** Tags: feature
>
> ** Tags added: feature
>
> --
> Parametered test should try to convert data type from source to paramter
> https://bugs.launchpad.net/bugs/601645
> You received this bug notification because you are a member of NUnit
> Developers, which is subscribed to NUnit V2.
>

-- 
Parametered test should try to convert data type from source to paramter
https://bugs.launchpad.net/bugs/601645
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.

Status in NUnit V2 Test Framework: New

Bug description:
This is rather a feature request. Look at below test:

[TestCase(10)] public void TestMethod(short a) { }

That looks quite valid at the first glance but it of cause failed. The right syntax is

[TestCase((short)10)] public void TestMethod(short a) { }

Same problem goes to float type and/or Values attribute.

Would it be possible for NUnit to have the TestCase and Values attributes to convert the type based on the method signature?

See http://groups.google.com/group/nunit-discuss/browse_thread/thread/22898e500f20351b/ff87c7d3169be55b?hl=en&lnk=gst&q=short+type+in+parametrized+test+%09%09%09%09#ff87c7d3169be55b





References