Incremental development with Monorail: Part Four
We finished up in the last instalment by moving down a layer into our newly introduced BlogPostService. Our tests are passing yet our application is still pretty lacking in the actual functionality department. To move things on a stage further we need to:
- Map from the AddPostRequestDto to our actual BlogPost aggregate root.
- Validate the BlogPost.
- Persist our new BlogPost.
We need to write another test to flesh out the interaction between our service and something that can map from the DTO to our BlogPost:
We’re now expecting the BlogPostService to accept the mapper in its constructor, and defining an interaction between the service and the mapper. Before we can get this to compile we need to make a few more changes to our test fixture:
We’ve modified an existing test to allow for our new dependency and performed some setup tasks. We’ve introduced the IBlogPostMapper and IBlogPost interfaces by way of our test. Running the test causes the compiler to choke so lets go ahead and implement what we need to pass the tests:
Lets go ahead and run our BlogPostServiceFixture tests:
Righteo, that went well. For the sake of completeness lets run our full test suite:
The integration test is failing as we’ve yet to wire up the BlogPostService dependencies in the container. Before we can do this we need to drive out the interfaces we’ve introduced. We’ll do that in the next post.