Using Fluent NHibernate persistence testing
Mappings are a critical part of any NHibernate application. In this recipe, we'll show you how to use Fluent NHibernate's persistence testing, in order to make sure that your mappings work as expected. You don't have to use Fluent NHibernate mappings in order to take advantage of this recipe.
Getting ready
Complete the Fast testing with the SQLite in-Memory database recipe mentioned earlier in this chapter.
How to do it...
Install
FluentNHibernateusing the NuGet Package Manager Console by executing the following command:Install-Package FluentNHibernateIn
PersistenceTests.cs, add the followingusingstatement:using FluentNHibernate.Testing;
Add the following three tests to the
PersistenceTestsfixture:[Test] public void Product_persistence_test() { new PersistenceSpecification<Product>(Session) .CheckProperty(p => p.Name, "Product Name") .CheckProperty(p => p.Description, "Product Description") .CheckProperty(p => p.UnitPrice...