TestCaseAttribute includes behavior to perform conversion of some parameter types to the desired target type. Amongst others, conversion from String to DateTime and from String to TimeSpan are supported. This is useful, because no constants of these target types can be defined in the TestCaseAttribute.
It would be nice if DateTimeOffset could be added could be added to the list of supported conversions.
For example:
[TestCase("2018-10-09 15:15:00+02:00")]
public void MyTest(DateTimeOffset foo)
{
}
Convert.ChangeType does not appear to work for DateTimeOffset, so the code would be similar to the code for TimeSpan.
I wouldn't mind creating a PR for this if that helps; it seems fairly straightforward to add.
NUnit version: latest master
TestCaseAttributeincludes behavior to perform conversion of some parameter types to the desired target type. Amongst others, conversion fromStringtoDateTimeand fromStringtoTimeSpanare supported. This is useful, because no constants of these target types can be defined in theTestCaseAttribute.It would be nice if
DateTimeOffsetcould be added could be added to the list of supported conversions.For example:
Convert.ChangeTypedoes not appear to work forDateTimeOffset, so the code would be similar to the code forTimeSpan.I wouldn't mind creating a PR for this if that helps; it seems fairly straightforward to add.
NUnit version: latest master