Testing nHibernate Mappings

I just started a new project using nHibernate and Fluent for matching. The architect sent me a database from which I generated several hundred entity classes and the corresponding Fluent mapping files. I know this is not an ideal way to do DDD, but life is rarely perfect.

What I want to do is check that all the mappings are correct, the columns are mapped correctly, OneToMany, ManyToMany, etc. Is there any automatic or easy way to do this? I just looked at creating a simple repository that loads a record from each object and makes no exceptions, but most tables do not yet have data.

+3
source share
2 answers

See PersistenceSpecification in Fluent NHibernate. It is hardly ideal, but it copes well with many simple cases.

+4
source

To test ORM mappings, one of the strategies I used that saved hours of work includes using the string checking method in unit tests, such as the RowTest attribute in MBUnit or NUnit. This will save you from writing separate unit tests for different string values. Check out this webcast for a quick launch.

, : , , . , SQLLite SQL CE unit test. , , .

0

Source: https://habr.com/ru/post/1707649/


All Articles