could anyone give me a good example of using rhino mocks, nunit, and unity together. I am reading the help on each but there doesnt seem to be any good sample projects of how you would use them together and the way to set up projects /test projects using them. I.e. do you create new ioc containers in your test project which point to dummy classes. Then where does rhino come into it.
Thanks for any help.
I use all 3 of these frameworks together. It looks like your problem is you are trying to learn too many things at once.
As for using an IoC container in tests, I’ve never had the need to do this for unit tests- I just use Rhino mocks to pass in stubs/mocks for dependent components as required.
For an integration test I could see the benefit of having an IOC container initialised in some code, for example if you were using the MVP pattern and wanted to completely replace a GUI with stubs.
I would first learn about Unit testing in more detail. I highly recommend the book The Art of Unit Testing. A good book that combines IOC, Unit testing and an isolation framework, I found was Pro ASP.NET MVC– there is now a 2nd edition, but as I’ve not read it, I can’t really comment on it. The book doesn’t use Unity, but if you learn how one framework works, it is easy to switch to using another. When I moved from Moq to Rhino, I found this wiki page particularly useful.