Database persistence via Entity Models
Access to the models goes into src/adapters
or src/repository
. A Repository mediates between the domain and data mapping layers, acting like an in-memory domain object collection (POEAA).
Business logic, coordination and controlling transactions goes into src/services
Mappers between Input Model and Entity Models go into src/transformers
Routing of requests goes to src/controllers
and repository is injected into the controllers
Naming test: Noun_Should_Verb
AAA Testing Pattern
Do not have more than one assert per test, or if you do, test the same concept.
Do not test database in unit tests, it slows down your tests and it is not reproducible: complicates set up and tear down
Pass fake repository/adapter into controller or business logic class
- Arrange
- Act
- Assert