Hi Dimitar,
The tutorial provided by the link is excellent and I am using that same approach when I am testing my application/objects interface with the database. However, it does not provide a way to test your business objects and business logic independent of OpenAccess.
For example, I have a persistent Person class. I can use your approach to test whether I can add this class to the database successfully. That's great and very useful indeed.
However, I also have a PersonService class that encapsulates some business logic involved in adding people to the database. For example, I might want to keep track of a blacklist of people that I do not want to have added to the database. As the PersonService uses it's own instance of the ObjectScope, the automatic rollback provided by your example doesn't work.
In addition to that, I would like to be able to test just the business logic, not the interface to the database. That is why I suggested mocking to abstract out the database access.
I am currently working through the example I outlined above to see if mocking would be possible. I will certainly keep you posted on my progress.
Regards,
Erik