Welcome back. In this post I’ll be getting our tests passing again and cleaning things up a little. We left off with a failing integration test:
I suspect this is due to the IBlogPostMapper dependency we introduced to our BlogPostService not being handled by the container. If we run in the browser we can confirm this is in fact true:
As we’ve yet to implement our IBlogPostMapper we must go ahead and do this before we can add the container configuration to pass our integration test. Lets bust out a test and get things rolling:
We have a few blanks to fill in in order to get this to compile and run:
- Make the DTO’s properties virtual so we can mock them. This is in preference to extracting an interface.
- Implement IBlogPostMapper.
- Add the necessary properties to the IBlogPost interface.
Lets go ahead and do this now:
IBlogPostMapper minimal implementation:
The necessary modifications to IBlogPost:
Now we can compile and run our test:
Our BlogPostMapper implementation is throwing an exception so lets go back and take another step to try and pass our test:
I’m pretty certain we’ve done enough to pass our test now. Lets have a go:
OK now lets focus on the full suite:
Our integration test is still bombing but as we’ve got a mapper now, we can go ahead and wire up our Windsor configuration and get things moving again:
We’ve added another configuration file: mapper.config and referenced this from the web.config. We shouldn’t need to do any more than this so lets run our full test suite:
Our full suite is passing now. Not bad for 5 minutes work! As usual the latest changes are checked in to the Google code project hosted here.
Now we have a full passing suite, in our next edition I’ll be moving down into the persistence and also incorporating a few modifications from Hammett. Stay tuned!