Unit test to ensure hbm files are embedded resources

2 views
Skip to first unread message

Stefan Moser

unread,
Nov 18, 2008, 5:14:44 PM11/18/08
to nhu...@googlegroups.com
I can't count the number of times that I've forgotten to set an hbm file as an embedded resource.  Has anyone ever written a test to ensure that all of the hbm files in a project are embedded resources?  Any tips on how to write such a test?

Stefan

Gustavo Ringel

unread,
Nov 18, 2008, 5:24:05 PM11/18/08
to nhu...@googlegroups.com
If you use resharper and the nh plugin it alerts you if the hbm is not an embedded resource.

You can take one of the options without mappings also (fluen interface, fabio's example in his blog)

Gustavo.

Stefan Moser

unread,
Nov 18, 2008, 5:30:14 PM11/18/08
to nhu...@googlegroups.com
I will try the plugin, but not everyone on my team has ReSharper.  The only way that I can think of detecting this is to inspect the project file, but given that tests are executed from a variety of locations it makes relative paths to the project file difficult.  I could list a number of relative paths where the project file might be, that's the best I can come up with.

Stefan

Gustavo Ringel

unread,
Nov 18, 2008, 5:33:07 PM11/18/08
to nhu...@googlegroups.com
Anyway if you have CRUD tests hitting the DB...every test where you forgot the HBM embedded resource will fail...i know you won't get a message: "Put the hbm as embedded resource" but at least you will know it is failing and it is going to be your first try to correct the test...

Gustavo.

Stefan Moser

unread,
Nov 18, 2008, 5:34:43 PM11/18/08
to nhu...@googlegroups.com
That's really my problem.  Someone on the team struggles for a while because something is failing and they can't figure out why.  It would be much nicer to point directly to where the problem is.

Stefan
Reply all
Reply to author
Forward
0 new messages