Charlie Poole
2008-06-19 01:30:37 UTC
Hi All,
Aside from the whole issue of /when/ parameterized
tests are created - i.e. the static/dynamic thing I
wrote about in a separate mail - there is a question
of what degree of conversion should be performed on
the supplied data. I'll tell you what I propose -
please give me your comments:
1. Data supplied by a field, property or method
marked with the FactoryAttribute will not be converted
at all. Normal implicit conversions will apply when
NUnit calls the method. If the data provided is not
assignable to the argument, the test case will be
marked as not runnable.
2. Data supplied in an attribute requires some extra
conversion, due to the limitations on types that may
appear in an attribute constructor. I propose the
following:
2.1 Only widening numeric conversions will be made
2.2 If a string is provided, it will be converted
in the following cases:
2.2.1 When the parameter type is DateTime
2.2.2 When the parameter is a class with a
constructor that takes a string.
2.2.2 When the parameter type implements Parse
2.3 If the arg is neither numeric nor a string, and
implements IConvertible, we will try to convert
it to the type of the parameter using Convert.
Note that I could have covered both numerics and strings
under IConvertible, but I felt that too many conversions
would be performed in that case.
Charlie
Note: We could also try to convert any args that
implement IConvertible for
because it seems to me that IC
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
Aside from the whole issue of /when/ parameterized
tests are created - i.e. the static/dynamic thing I
wrote about in a separate mail - there is a question
of what degree of conversion should be performed on
the supplied data. I'll tell you what I propose -
please give me your comments:
1. Data supplied by a field, property or method
marked with the FactoryAttribute will not be converted
at all. Normal implicit conversions will apply when
NUnit calls the method. If the data provided is not
assignable to the argument, the test case will be
marked as not runnable.
2. Data supplied in an attribute requires some extra
conversion, due to the limitations on types that may
appear in an attribute constructor. I propose the
following:
2.1 Only widening numeric conversions will be made
2.2 If a string is provided, it will be converted
in the following cases:
2.2.1 When the parameter type is DateTime
2.2.2 When the parameter is a class with a
constructor that takes a string.
2.2.2 When the parameter type implements Parse
2.3 If the arg is neither numeric nor a string, and
implements IConvertible, we will try to convert
it to the type of the parameter using Convert.
Note that I could have covered both numerics and strings
under IConvertible, but I felt that too many conversions
would be performed in that case.
Charlie
Note: We could also try to convert any args that
implement IConvertible for
because it seems to me that IC
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php