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
Open source project written in the latest version of ASP.NET Core, implementing the concepts of S.O.L.I.D, Clean Code,
29
-
CQRS (Command Query Responsibility Segregation)
27
+
This repository is an open-source reference implementation of ASP.NET Core using Clean Architecture, CQRS, and Event Sourcing principles. It is designed to demonstrate how to structure a production-ready solution around separation of concerns, testability, and maintainability.
30
28
31
29
## Give it a star! ⭐
32
30
33
-
If you liked this project, learned something, give it a star. Thank you!
31
+
If you found this project useful, please consider giving it a star. Thank you!
3. Create a `.env` file with the required environment variables:
82
83
83
84
```yaml
84
85
MSSQL_SA_PASSWORD=YOUR_STRONG_!Passw0rd
@@ -89,23 +90,89 @@ REDIS_PORT=6379
89
90
ASPNETCORE_ENVIRONMENT=Development
90
91
```
91
92
92
-
Next step, run the command in the terminal:
93
+
4. Start the infrastructure and application containers:
93
94
94
-
```csharp
95
-
docker-composeup--build
95
+
```bash
96
+
dockercompose up --build
96
97
```
97
98
98
-
Now just open the url in the browser:
99
+
5. Open the API documentation in your browser:
99
100
100
-
```csharp
101
+
```text
101
102
http://localhost:{port}/scalar/v1
102
103
```
103
104
104
-
## MiniProfiler for .NET
105
+
## Unit Testing
105
106
106
-
To access the page with the performance indicators and performance:
107
+
This repository uses a layered testing strategy to keep the solution reliable while preserving the principles of Clean Architecture and CQRS.
108
+
109
+
- Unit tests are located in [tests/Shop.UnitTests](tests/Shop.UnitTests) and focus on domain entities, value objects, validators, handlers, queries, and mapping logic.
110
+
- Integration tests are located in [tests/Shop.IntegrationTests](tests/Shop.IntegrationTests) and cover API and infrastructure behavior.
111
+
112
+
### Test stack
113
+
114
+
The unit test project in [tests/Shop.UnitTests/Shop.UnitTests.csproj](tests/Shop.UnitTests/Shop.UnitTests.csproj) uses:
115
+
116
+
- xUnit for test execution
117
+
- FluentAssertions for readable assertions
118
+
- NSubstitute for dependency mocking
119
+
- Coverlet for coverage reporting
120
+
- Microsoft.EntityFrameworkCore.Sqlite for database-backed tests
121
+
122
+
### How to run tests
123
+
124
+
From the repository root, run:
125
+
126
+
```bash
127
+
dotnet test tests/Shop.UnitTests/Shop.UnitTests.csproj
128
+
```
129
+
130
+
To run the full solution test suite:
131
+
132
+
```bash
133
+
dotnet test Shop.slnx
134
+
```
135
+
136
+
To run a subset of tests by name:
137
+
138
+
```bash
139
+
dotnet test tests/Shop.UnitTests/Shop.UnitTests.csproj --filter "FullyQualifiedName~CreateCustomer"
140
+
```
141
+
142
+
### Example test case
143
+
144
+
A typical unit test follows the xUnit and FluentAssertions pattern used throughout the project:
0 commit comments