Hello,
Thank you for the response! I never came across those situations when
I coded the helpers, so they didn't make it in. Now you have, so I
made the following updates:
1.) Added support for handling nullable types in CreateInstance<T>.
2.) Added support for double for CreateInstance<T> and CreateSet<T>.
I made a pull request for these updates here:
http://github.com/techtalk/SpecFlow/pull/13
With regards to TimeSpan, I'm not sure how to best express a
TimeSpan. Handling things like int, DateTime, decimal, etc. are easy
because I can just take the string from the table and run Convert over
it. I do no interpretation of the values, so .Net does all the work.
But when it comes to things like TimeSpan and Enumerations (do you
mean CreateSet<T>?), there would probably have to be some
interpretation. I'm not sure that type of interpretation on
SpecFlow's part would be a good thing.
With these helper methods, the thing to keep in mind is that they are
meant to be *helpers* and nothing else. If you have a complex
property type or if you have something that the helper doesn't manage,
you might have to do the work manually. For example, if I had a step
like this:
And my account has these values:
| Field |
Value |
| FirstName |
Darren |
| LastName |
Cauthon |
| ThisIsAnEnumWhichIsNotCurrentlySupported | EnumValue1 |
You might have to use code like the following to get the values out:
var account = table.CreateInstance<Account>();
account.ThisIsAnEnumWhichIsNotCurrentlySupported = // pull the value
out of the table manually
In this case, FirstName and LastName are strings, but that third
property is one that won't be covered by CreateInstance<T>. It might
not seem optimal to have to do manual work like that *on top* of the
CreateInstance<T> call, but hey... what would you have done if the
helper method didn't exist? :)
But thanks again for passing these issues along, and please send any
other feedback as well!
Darren Cauthon
On Oct 16, 11:10 am, Großes mächtiges Männchen <
alex_wink...@aon.at>
wrote: