PDA

View Full Version : Data driven unit tests: how does the test framework determine the datarow-order?



Bsbosa.com
07-09-2010, 01:20 PM
Hi,

I am currently writing some unit tests for my C# application, so I made an Access database with various datasets containing multiple test values. The first column contains an ID which is only a number starting at 1 in the first row, and is increased every next line. This is my primary key.

I implement this test database in my Test class like this:

[DataSource("System.Data.OleDb", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\TestData.mdb", "CValues", DataAccessMethod.Sequential), DeploymentItem("Tests\\TestData.mdb"), TestMethod()]

This works fine, however when I display the test results in VS 2010, the "Data Row" does not match the order in my database. Currently, my Database has about 30 entrys, and the datarow-output in VS 2010 begins with row 8 from my database, going to the end, and the first 7 rows in my database are displayed as the last datarows in VS 2010.

I would really appreciate if I had the same datarow order in access and VS2010 so I can easily compare both of them.

How can this be achieved?