0

I am mapping some table valued functions in nHibernate using HBM files. Our table functions have been changing quite a bit lately, so I want to make sure our mapping files are updated when these changes are made. I am able to unit test my mapping files by running my function that loads the HBM query, adds parameters and executes the query. If my mapping file has an extra column, a misspelled column or a wrong datatype, I know something is wrong because the query will fail.

But the query does not fail if the table valued function contains a new column that my mapping file does not? Is there any way to add this to my tests?

gwin003
  • 7,432
  • 5
  • 38
  • 59

1 Answers1

0

You will need data. An in memory sqlite could do the trick. On your test, you'd insert a item on database and read it inmediatly. All selected fields values should be the same as inserted values.

Claudio Redi
  • 67,454
  • 15
  • 130
  • 155
  • But my test will have no knowledge of NEW columns, so how could I populate and verify a field that my test has no knowledge of? – gwin003 May 15 '13 at 13:23
  • 2
    @gwin003: probably I got you wrong. I thought you wanted to validate that your mapping was correct provided your domain class contained the correct properties matching your db model. Your scenario is a corner case situation IMO: if you add a field you normally add functionallity on your code to use it. Forgot to add it to your domain classes it's something weird and almost indicates that field is not useful at all. – Claudio Redi May 15 '13 at 13:31