Testing a Domain Entity with Unit Tests
Learn how to test an entity with unit tests.
We'll cover the following
We start by looking at a domain entity at the center of our architecture. Let’s recall the Account
entity from the chapter “Implementing a Use Case”. The state of an Account
consists of a balance the account had at a certain point in the past (the baseline balance) and a list of deposits and withdrawals (activities) since then.
Account test
We now want to ensure that the withdraw()
method works as expected:
Get hands-on with 1400+ tech skills courses.