Data driven unit tests: how does the test framework determine the datarow-order?
-
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?
-
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?
Hi, AFAIK database query results are ordered as much as you request them to be in a specific order; without an ORDER BY clause, they are in random order. If you don't want to add an ORDER BY clause, the best you can do is sort the results yourself before comparing them with your expected set of results. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
Hi, AFAIK database query results are ordered as much as you request them to be in a specific order; without an ORDER BY clause, they are in random order. If you don't want to add an ORDER BY clause, the best you can do is sort the results yourself before comparing them with your expected set of results. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.