I'm using the MS UnitTestFramework library for some unit testing. Some of my tests use the [DataSource] attribute to get its data, some of them use a custom GetData that gets MTM data and store results into a list of custom objects, and some of them do both.
The TestMethods that use both use the [DataSource] data as 'parent' data. An iteration of the test with the parent data will put all of its test steps inside a loop that goes through each data object in the list returned by our GetData call. All in all the whole thing is sort of like a for loop nested in another for loop.
My question is this: Is there a way to achieve this behavior with just the DataSource attribute?
EX: MTM Test Case 1 has datarows 1 and 2. MTM Test Case 2 has datarows a, b, and c. My TestMethod runs 6 times: 1a, 1b, 1c, 2a, 2b, 2c.
(I'm aware I could just make a case with 6 DataRows, but that's not a scalable solution.)
So I think I have a solution of sorts. It's different from what I had previously been doing and I also havent implemented it yet, it's just an idea. If I get my data from a database instead, I might be able to make tables that stores TestCase 1 and 2's data, and have a view for each test case table that cross joins it to a 'parent' test case, then have the [DataSource] look at that view. Haven't done the research yet, but if DataSource allows me to get rows from a stored procedure then that'd be better than views.