[nunit-discuss] short type in parametrized test

1 view
Skip to first unread message

Kenneth Xu

unread,
May 12, 2010, 12:12:19 PM5/12/10
to NUnit-Discuss
Hi All,

I guess this is rather a feature request instead of a bug report. But 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.

This is not new to me, I found myself keep making the same mistake. The reason I brought it up today is I got 4th report from developers in our team. So it seems that not only me tumbled on it.

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

Thanks,
Kenneth

--
You received this message because you are subscribed to the Google Groups "NUnit-Discuss" group.
To post to this group, send email to nunit-...@googlegroups.com.
To unsubscribe from this group, send email to nunit-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nunit-discuss?hl=en.

Charlie Poole

unread,
May 13, 2010, 6:06:29 AM5/13/10
to nunit-...@googlegroups.com
Hi Kenneth,

I agree. You can tag the bug as a feature if you like. In case the value is too large,
I think we should continue with the existing behavior.

Charlie
Reply all
Reply to author
Forward
0 new messages