O'Reilly logo

NHibernate 3.0 Cookbook by Jason Dentler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the Fluent NHibernate Persistence Tester

Mappings are a critical part of any NHibernate application. In this recipe, I'll show you how to test those mappings using Fluent NHibernate's Persistence tester.

Getting ready

Complete the Fast testing with SQLite in-Memory database recipe mentioned previously in this chapter.

How to do it...

  1. Add a reference to FluentNHibernate.
  2. In PersistenceTests.cs, add the following using statement:
    using FluentNHibernate.Testing;
  3. Add the following three tests to the PersistenceTests fixture:
    [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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required