SanjaySi

Hi

I was looking for Assertion that could compare two rowset no matter in what order the rows are present. The database unit test provides conditions such as row count, no of result sets, empty result set, etc. I want to compare the output of a select query with another result set for every row. Is there such conditions available or do we need to write an external module

Regards

Sanjay Singh



Re: Visual Studio Team System - Database Professionals Comparing the rowset in unit testing

Grant Fritchey

I wrote a rudimentary version of this and posted it in a little article over at SQL Server Central. It needs more work, but it'll get you started. Oh, and the XML was good for the CTP, but the requirements are different in RTM.



Re: Visual Studio Team System - Database Professionals Comparing the rowset in unit testing

SanjaySi

Thanks Grant for providing the link. However this code is going to be performance intensive as every cell is compared. Another requirement that it would not meet was if the rows were in different order then it will fail the test. I was just thinking whether the CollectionAssert.AreEquivalent present in the test framework can be used



Re: Visual Studio Team System - Database Professionals Comparing the rowset in unit testing

katls - MSFT

Also there is a good blog entry on how to do this with an example creating a custom test condition, if you want another one to look at:

http://blogs.msdn.com/sachinre/archive/2006/08/22/Creating-a-custom-test-condition_3A00_-ResultSet-Column-Count.aspx

There's also a 15 minute video on the blog about creating a custom test condition for database unit testing:

http://blogs.msdn.com/sachinre/archive/2006/10/12/video-on-creating-a-custom-test-condition.aspx





Re: Visual Studio Team System - Database Professionals Comparing the rowset in unit testing

Grant Fritchey

No doubt. It really was a first pass. We're working on refining it in such a way that we can determine row order, etc.