Skip to content

Commit 8663763

Browse files
committed
refactor: Update documentation to reflect test project splitting and simplify localization examples.
1 parent fb937e8 commit 8663763

5 files changed

Lines changed: 24 additions & 21 deletions

File tree

CONTRIBUTING.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,10 @@ Understanding the architecture helps you contribute effectively:
202202
- **BookStore.Web** - Blazor frontend
203203
- **BookStore.AppHost** - Aspire orchestration
204204
- **BookStore.ServiceDefaults** - Shared configuration
205-
- **BookStore.Tests** - Unit tests
205+
- **BookStore.Shared** - Shared library
206+
- **BookStore.Shared.Tests** - Shared unit tests
207+
- **BookStore.ApiService.Tests** - API unit tests
208+
- **BookStore.Web.Tests** - Web tests
206209

207210
Key patterns:
208211
- **Event Sourcing** - All state changes via events

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ curl -X POST http://localhost:5000/api/admin/categories \
188188
-d '{
189189
"name": "Software Architecture",
190190
"translations": {
191-
"pt": {"name": "Arquitetura de Software"},
192-
"es": {"name": "Arquitectura de Software"}
191+
"en": {"name": "Software Architecture"},
192+
"pt": {"name": "Arquitetura de Software"}
193193
}
194194
}'
195195
```

docs/getting-started.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ curl -X POST http://localhost:5000/api/admin/categories \
150150
"name": "Software Architecture",
151151
"description": "Books about software design and architecture",
152152
"translations": {
153+
"en": {
154+
"name": "Software Architecture",
155+
"description": "Books about software design and architecture"
156+
},
153157
"pt": {
154158
"name": "Arquitetura de Software",
155159
"description": "Livros sobre design e arquitetura de software"
@@ -271,10 +275,10 @@ The project uses **TUnit**, a modern testing framework for .NET with built-in co
271275
dotnet test
272276

273277
# Run tests for specific project
274-
dotnet test --project src/BookStore.Tests/BookStore.Tests.csproj
278+
dotnet test --project src/ApiService/BookStore.ApiService.Tests/BookStore.ApiService.Tests.csproj
275279

276280
# Alternative: Run tests directly
277-
dotnet run --project src/BookStore.Tests/BookStore.Tests.csproj
281+
dotnet run --project src/ApiService/BookStore.ApiService.Tests/BookStore.ApiService.Tests.csproj
278282
```
279283

280284
### Test Structure

docs/localization-guide.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Localization is configured in `appsettings.json` under the `Localization` sectio
5050
{
5151
"Localization": {
5252
"DefaultCulture": "en-US",
53-
"SupportedCultures": ["en-US", "pt-PT", "es-ES", "fr-FR", "de-DE"]
53+
"SupportedCultures": ["en-US", "pt-PT"]
5454
}
5555
}
5656
```
@@ -60,7 +60,7 @@ Localization is configured in `appsettings.json` under the `Localization` sectio
6060
{
6161
"Localization": {
6262
"DefaultCulture": "pt-PT",
63-
"SupportedCultures": ["pt-PT", "en-US", "es-ES"]
63+
"SupportedCultures": ["pt-PT", "en-US"]
6464
}
6565
}
6666
```
@@ -119,10 +119,7 @@ public record CategoryTranslation(string Name, string? Description);
119119
```json
120120
{
121121
"en": { "name": "Programming", "description": null },
122-
"pt": { "name": "Programação", "description": null },
123-
"es": { "name": "Programación", "description": null },
124-
"fr": { "name": "Programmation", "description": null },
125-
"de": { "name": "Programmierung", "description": null }
122+
"pt": { "name": "Programação", "description": null }
126123
}
127124
```
128125

@@ -170,7 +167,7 @@ You can configure different languages for different environments:
170167
{
171168
"Localization": {
172169
"DefaultCulture": "en-US",
173-
"SupportedCultures": ["en-US", "pt-PT", "es-ES", "fr-FR", "de-DE"]
170+
"SupportedCultures": ["en-US", "pt-PT"]
174171
}
175172
}
176173
```

docs/testing-guide.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ The project uses **TUnit v1.6.28**, a modern testing framework for .NET that pro
2222
dotnet test
2323

2424
# Run tests for specific project
25-
dotnet test --project src/BookStore.Tests/BookStore.Tests.csproj
25+
dotnet test --project src/ApiService/BookStore.ApiService.Tests/BookStore.ApiService.Tests.csproj
2626

2727
# Run tests directly (alternative method)
28-
dotnet run --project src/BookStore.Tests/BookStore.Tests.csproj
28+
dotnet run --project src/ApiService/BookStore.ApiService.Tests/BookStore.ApiService.Tests.csproj
2929
```
3030

3131
### IDE Support
@@ -41,11 +41,10 @@ TUnit works with all major .NET IDEs:
4141
### Test Files
4242

4343
```
44-
src/BookStore.Tests/
44+
src/ApiService/BookStore.ApiService.Tests/
4545
├── Handlers/
4646
│ └── BookHandlerTests.cs # Command handler tests
47-
├── JsonSerializationTests.cs # JSON standards verification
48-
└── WebTests.cs # Integration tests with Aspire
47+
└── JsonSerializationTests.cs # JSON standards verification
4948
```
5049

5150
### Test Anatomy
@@ -145,7 +144,7 @@ await Assert.ThrowsAsync<InvalidOperationException>(async () =>
145144

146145
Test individual command handlers in isolation using mocked dependencies.
147146

148-
**Example**: [BookHandlerTests.cs](file:///Users/antaoalmada/Projects/BookStore/src/BookStore.Tests/Handlers/BookHandlerTests.cs)
147+
**Example**: [BookHandlerTests.cs](file:///Users/antaoalmada/Projects/BookStore/src/ApiService/BookStore.ApiService.Tests/Handlers/BookHandlerTests.cs)
149148

150149
```csharp
151150
[Test]
@@ -171,7 +170,7 @@ public async Task UpdateBookHandler_WithMissingBook_ShouldReturnNotFound()
171170

172171
Verify that the API follows JSON standards (ISO 8601, camelCase, etc.).
173172

174-
**Example**: [JsonSerializationTests.cs](file:///Users/antaoalmada/Projects/BookStore/src/BookStore.Tests/JsonSerializationTests.cs)
173+
**Example**: [JsonSerializationTests.cs](file:///Users/antaoalmada/Projects/BookStore/src/ApiService/BookStore.ApiService.Tests/JsonSerializationTests.cs)
175174

176175
```csharp
177176
[Test]
@@ -188,7 +187,7 @@ public async Task DateTimeOffset_Should_Serialize_As_ISO8601_With_UTC()
188187

189188
Test the full application stack using Aspire.Hosting.Testing.
190189

191-
**Example**: [WebTests.cs](file:///Users/antaoalmada/Projects/BookStore/src/BookStore.Tests/WebTests.cs)
190+
**Example**: [WebTests.cs](file:///Users/antaoalmada/Projects/BookStore/src/Web/BookStore.Web.Tests/BookStore.Web.Tests.csproj)
192191

193192
```csharp
194193
[Test]
@@ -286,7 +285,7 @@ When running in GitHub Actions, TUnit automatically:
286285
run: dotnet build --no-restore --configuration Release
287286

288287
- name: Run tests
289-
run: dotnet test --project src/BookStore.Tests/BookStore.Tests.csproj --configuration Release --no-build ${{ github.event_name == 'pull_request' && '--fail-fast' || '' }}
288+
run: dotnet test --project src/ApiService/BookStore.ApiService.Tests/BookStore.ApiService.Tests.csproj --configuration Release --no-build ${{ github.event_name == 'pull_request' && '--fail-fast' || '' }}
290289
# TUnit automatically generates GitHub Actions test summary
291290
# Results appear in the workflow run summary with collapsible details
292291
# --fail-fast: Stop on first failure in PRs for quick feedback

0 commit comments

Comments
 (0)