You shouldn't really take the values from the dataGrid itself, because this is just the UI control. Instead, you should find out where are they coming from (where the grid is populated) and hook up there. Then you will have all the data of correct types and hopefully it will not be UI dependent.
+3
A:
Grzenio
2009-03-06 12:36:57
+1, a view should not be stateful, it's a representation of state
Michael Meadows
2009-03-06 13:50:33
A:
Here's an MSDN article on data-driven unit tests:
http://msdn.microsoft.com/en-us/library/ms404708%28VS.80%29.aspx
There's a worked example there that includes using a database to store the values to plug into your unit tests.
I'd recommend against full code generation (i.e. code that generates your unit test bodies as well as the values to test with), as you end up putting code between your test cases and the tested code itself, which may lead to subtle inconsistencies or bugs.
Dave R.
2009-03-06 12:42:18