When I test db queries, I want to involve a data source. I want to test that 
the query returns correct data - that's what I want to test.

What would "1" below give you (more than code coverage)? I defiantly would say 
2.


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
vitalya
Sent: den 16 december 2008 00:29
To: nhusers
Subject: [nhusers] How to test Finder pattern


Hello everyone,

What are the best options to test Finder pattern by Ayende (http://
ayende.com/Blog/archive/2006/12/07/
ComplexSearchingQueryingWithNHibernate.aspx)? I've been using this
pattern in the projects, that almost had no unit tests, and now after
some investigation it turned out that to test such code is not a piece
of cake. Neither  DetachedCriteria nor ICriteria do not provide public
interface for getting Criterions \ Restrictions, that were set in the
Add method. After some discussions within a team we see 2 not cool
options:
1. Provide ISession mock to GetExecutableCriteria method, cast
ICriteria to CriteriaImpl and assert it
2. Make kind of integration tests and run the query against the test
database, with pre-created test data.

Are we missing something? What are the best practices for such case?

Thanks in advance!




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to