Here are some of the issues that you might face in testing F# code:
- I want to keep my test code out of my production assembly.
- I need a CLS-friendly API that doesn't expose F#-specific types.
- I want to test at as fine-grained a level as I can.
My answer? It's simple, I just compile my SUT without including my interface (.fsi) file! When you do this, every value declared in your source (.fs) file is exposed to the world for testing. Then, when I compile for release, I include the interface file and all of that stuff is hidden.
Thus far, I've found no issues with NUnit working in this manner and it's given me the Best of Both Worlds as far as test coverage and CLS-friendly API's go!
No comments:
Post a Comment