Skip to content

Commit 56eb300

Browse files
committed
Update README (unit tests)
1 parent 108e55b commit 56eb300

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ This is list of main goals of this repository:
7272
- Presentation of the use of **design patterns**. When, how and why they can be used
7373
- Presentation of some **architectural** considerations, decisions, approaches
7474
- Presentation of the implementation using **Domain-Driven Design** approach (tactical patterns)
75+
- Presentation of the implementation of **Unit Tests** for Domain Model (Testable Design in mind).
7576

7677
### 1.2 Out of scope
7778

@@ -402,6 +403,10 @@ Primitive attributes of Entites grouped together using ValueObjects.
402403

403404
All classes, methods and other members named in business language used in this Bounded Context.
404405

406+
6. **Testable**
407+
408+
Domain Model is critical part of system so it should be easy to test (Testable Design).
409+
405410
```csharp
406411
public class MeetingGroup : Entity, IAggregateRoot
407412
{
@@ -785,7 +790,7 @@ Each unit test has 3 standard sections: Arrange, Act and Assert
785790

786791
The Arrange section is responsible for preparing the Aggregate for testing the public method that we want to test. This public method is often called from the unit tests perspective as SUT (system under test).
787792

788-
Creating an Aggregate ready for testing involves **calling one or more other public constructors/methods** on the Domain Model. At first it may seem that we are testing too many things at the same time, but this is not true. We need to be in one percent sure, that the Aggreagate is in state exactly as it will be in production. This can only be ensured when:
793+
Creating an Aggregate ready for testing involves **calling one or more other public constructors/methods** on the Domain Model. At first it may seem that we are testing too many things at the same time, but this is not true. We need to be in one hundred percent sure, that the Aggregate is in state exactly as it will be in production. This can only be ensured when:
789794

790795
- **we use only public API of Domain Model**
791796
- we don't use [InternalsVisibleToAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.internalsvisibletoattribute?view=netframework-4.8) class. This exposes Domain Model to Unit Tests library removing encapsulation so our tests and production code is treated differently and it is very bad thing.

docs/Images/UnitTestsGeneral.jpg

2.8 KB
Loading

0 commit comments

Comments
 (0)