For every entity that I create I write a unit test that just loads one record from the database to see if the query works and the data can be set on the entity correctly. You could see this as a unit test for the basic mapping. This should also confirm that a mapping file exists for the type and is set as embedded resource.
The test looks like this (test resides in generic base class):
session.CreateCriteria(typeof(TEntity)).SetMaxResults(1).List();
I don't do any assertions, I just want to see if this line works without throwing exceptions.
Now in one case I forgot to set the mapping file as embedded resource but the test still worked. No query was sent to the database however, so it basically didn't do anything.
Why doesn't CreateCriteria() or List() fail for an unmapped type? And how can I test for that specific requirement?
EDIT: If found that the following line does throw an exception, but still wondering about the first case
session.CreateCriteria(typeof(TEntity)).SetMaxResults(1).Future<TEntity>().ToArray()