tags:

views:

179

answers:

2
+3  A: 

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.

Grzenio
+1, a view should not be stateful, it's a representation of state
Michael Meadows
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.