.NET persistence supporting test data

We currently use SubSonic as our persistence layer because it glows, but also because it allows us to load test data so that our DAL can be tested without hitting the database. I really love that about SubSonic. However, since we also face other problems with SubSonic, I am currently looking for an alternative while our project is still young. In short, is there another persistence system for .NET that will allow developers to use sub in test data?

+2


source to share


3 answers


UPDATE: After a long search, we switched to NHibernate as our persistence layer and changed the unit testing philosophy for the repository layer. We concluded that we would switch to an integration that tests the repository level while testing all other layers at the same time.

Here's our rationale:



If we just unit test the repository level, we will never know how the query will be executed against the database. For example, if we use a memory solution like SQLite, all of our specs might go through at design time, but might not actually work once we deploy to production due to 1) differences in how each NHibernate data provider is implemented and 2) differences in how each product (SQLite vs MS MS SQL Server and Oracle) implements data types, T-SQL, etc.

0


source


AFAIK, hNibernate does not support this feature as it is, but it can be achieved if you configure the test database to run in in-memory mode. SQLite supports this mode.



Here's an example of setup and testing.

+1


source


I doubt you will find this feature to be another .NET ORM, but there is no reason why you can't code it yourself. If you want an ORM that scales with your project, NHibernate is your best bet. You might want to crush Ruby ORMs that run on .NET via IronRuby, but I'm not sure if you would do a fine job of implementing an acceptable solution.

0


source







All Articles