You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+6-1
Original file line number
Diff line number
Diff line change
@@ -72,6 +72,7 @@ This is list of main goals of this repository:
72
72
- Presentation of the use of **design patterns**. When, how and why they can be used
73
73
- Presentation of some **architectural** considerations, decisions, approaches
74
74
- 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).
75
76
76
77
### 1.2 Out of scope
77
78
@@ -402,6 +403,10 @@ Primitive attributes of Entites grouped together using ValueObjects.
402
403
403
404
All classes, methods and other members named in business language used in this Bounded Context.
404
405
406
+
6.**Testable**
407
+
408
+
Domain Model is critical part of system so it should be easy to test (Testable Design).
409
+
405
410
```csharp
406
411
publicclassMeetingGroup : Entity, IAggregateRoot
407
412
{
@@ -785,7 +790,7 @@ Each unit test has 3 standard sections: Arrange, Act and Assert
785
790
786
791
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).
787
792
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:
789
794
790
795
-**we use only public API of Domain Model**
791
796
- 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.
0 commit comments