I have an xml file from which I read data in the unit test : [DataSource]
For the xml line : <DataBool>true</DataBool>, I try to read value by :
bool bData = (bool)TestContext.DataRow[4];
But it throws exception - invalid casting.What is the possible efficient solution?
If there's no schema associated with it, then it's probably just a string. If so, use bool.Parse or bool.TryParse to convert it from a string to a bool.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With