When writing integration tests for business logic objects and data access objects, what makes the most sense to use for setup and validation? In my case, I'm using an ORM in the implementation of my data access interface that will be used in production, and I plumb that ORM implementation together with the business logic objects for integration testing. Given that the ORM implementation is tested separately using INSERT and SELECT statements for setup and validation, is it best for integration testing setup and validation to use the ORM implementation of the data access interface, to use the ORM directly, to use those INSERT and SELECT statements, or to do something else, edit: and why?
The ORM in this case is NHibernate, the ORM implementation of the data access interface is a simple pass-through to NHibernate's LINQ provider that also provides simple pagination and sorting mechanisms. I'm curious to know what you think, either generally or with this specific scenario.
edit: I'm not looking to know what DAO I should connect to the BL objects. That clearly should be the same DAO that will be used in production. The question is about the mechanism used to put data into the database to set up the test before the business logic function is tested. Presumably, the same mechanism would be used to poll the database after the business logic function is tested. Here's some very high-level pseudo-code to demonstrate what I mean:
Foo fooBefore = GenerateFooForTesting();
SomehowInsertIntoDatabase(foo); // What should be used here and why?
// Plumb things together; actually done using IoC, not hard-coded.
DaoFactory realDaoFactory = GetRealDaoFactory();
BizFactory realBizFactory = GetRealBizFactory();
realBizFactory.DaoFactory = realDaoFactory;
BusinessLogicObject biz = realBizFactory.BuildBusinessLogicObject();
Foo fooAfter = SomehowGetFooFromDatabase(fooBefore.Id); // Same question.