Testing Services

We want to test our Services to make sure we gain a client perspective on how we should model. We want our domain-focused tests to reflect the way the model should be used, while at this point ignoring some of the finer software correctness focus.

Isn’t It a Bit Late to Test?

I have normally introduced tests before implementations. I did show some test-first code snippets earlier when analyzing the need for a Service. It’s just that I found it more natural to discuss the implementation a bit earlier in this chapter, that’s all. However, this does show that test-first isn’t an absolute necessity, although it may limit a proper modeling focus.

These tests demonstrate how to properly use AuthenticationService, and we first test ...

Get Implementing Domain-Driven Design now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.