Fluent Nhibernate PersistenceSpecification : failed: System.ApplicationException – Expected List but got IList

This had me puzzled for a while this afternoon so I thought I’d put this post up.

I was trying to get an integration test running, checking to see that an object was being persisted correctly (against an im-memory SQLite database).
The test was failing with “failed: System.ApplicationException” Expected List<> but got IList<>

The problem was with the type of check I was doing. I was doing a property check but I should have been doing a “List” check.

Changing :

              .CheckProperty(y => y.list, myList)

To :

             .CheckList(y => y.list, myList)

Got it working.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s