# Test Project Alignment Design ## Problem After the architecture cleanup that created the Infrastructure project and reorganized code, the unit test projects no longer align with the source code projects. The generic `JdeScoping.Tests` project contains tests for multiple source projects (Core and Infrastructure), and several source projects have no corresponding test projects. ## Goal Achieve 1:1 mapping between source projects and test projects, ensuring every source project has a dedicated test project. ## Current State **Source Projects (9):** - JdeScoping.Api - JdeScoping.Client - JdeScoping.Core - JdeScoping.DataAccess - JdeScoping.Database - JdeScoping.DataSync - JdeScoping.ExcelExport - JdeScoping.Host - JdeScoping.Infrastructure **Test Projects (6):** - JdeScoping.Api.Tests - JdeScoping.Api.IntegrationTests - JdeScoping.DataAccess.Tests - JdeScoping.DataSync.Tests - JdeScoping.ExcelExport.Tests - JdeScoping.Tests (generic catch-all) ## Target State **Test Projects (10):** ``` tests/ ├── JdeScoping.Api.Tests/ (keep - already aligned) ├── JdeScoping.Api.IntegrationTests/ (keep - integration tests) ├── JdeScoping.Client.Tests/ (create - placeholder) ├── JdeScoping.Core.Tests/ (create - move tests from JdeScoping.Tests) ├── JdeScoping.DataAccess.Tests/ (keep - already aligned) ├── JdeScoping.Database.Tests/ (create - placeholder) ├── JdeScoping.DataSync.Tests/ (keep - already aligned) ├── JdeScoping.ExcelExport.Tests/ (keep - already aligned) ├── JdeScoping.Host.Tests/ (create - placeholder) └── JdeScoping.Infrastructure.Tests/ (create - move tests from JdeScoping.Tests) ``` **Deleted:** - JdeScoping.Tests (generic catch-all) ## Test File Movements | File | From | To | |------|------|-----| | JdeDateConverterTests.cs | JdeScoping.Tests/Unit/ | JdeScoping.Core.Tests/Unit/ | | QueryTypesTests.cs | JdeScoping.Tests/Unit/ | JdeScoping.Core.Tests/Unit/ | | FakeAuthServiceTests.cs | JdeScoping.Tests/Unit/ | JdeScoping.Infrastructure.Tests/Unit/ | ## Project Template ### Standard .csproj ```xml net10.0 enable enable false ``` ### Placeholder File (for empty projects) ```csharp // This file exists to ensure the test project compiles. // Add tests here as needed. namespace JdeScoping.{Name}.Tests; public class Placeholder { // Tests will be added here } ``` ## Changes Per Project ### 1. JdeScoping.Core.Tests (new) - Create project with standard template - Move `JdeDateConverterTests.cs` from `JdeScoping.Tests/Unit/` - Move `QueryTypesTests.cs` from `JdeScoping.Tests/Unit/` - Update namespace: `JdeScoping.Tests.Unit` → `JdeScoping.Core.Tests.Unit` - Reference: `JdeScoping.Core` ### 2. JdeScoping.Infrastructure.Tests (new) - Create project with standard template - Move `FakeAuthServiceTests.cs` from `JdeScoping.Tests/Unit/` - Update namespace: `JdeScoping.Tests.Unit` → `JdeScoping.Infrastructure.Tests.Unit` - References: `JdeScoping.Infrastructure`, `JdeScoping.Core` ### 3. JdeScoping.Client.Tests (new - placeholder) - Create project with standard template - Add placeholder file - References: `JdeScoping.Client`, `JdeScoping.Core` ### 4. JdeScoping.Database.Tests (new - placeholder) - Create project with standard template - Add placeholder file - Reference: `JdeScoping.Database` ### 5. JdeScoping.Host.Tests (new - placeholder) - Create project with standard template - Add placeholder file - Reference: `JdeScoping.Host` ### 6. JdeScoping.Tests (delete) - Remove from solution file - Delete entire directory ### 7. Solution File (JdeScoping.slnx) - Add 5 new test projects - Remove `JdeScoping.Tests` ## Verification 1. **Build succeeds** - `dotnet build` passes with 0 errors 2. **All tests pass** - `dotnet test` runs successfully 3. **Test count preserved** - 81 tests from JdeScoping.Tests split between Core.Tests (~77) and Infrastructure.Tests (~4) 4. **1:1 mapping achieved** - Every source project has a matching test project ## Expected Test Distribution | Test Project | Expected Tests | |--------------|----------------| | JdeScoping.Api.Tests | 33 | | JdeScoping.Api.IntegrationTests | 8 | | JdeScoping.Client.Tests | 0 (placeholder) | | JdeScoping.Core.Tests | ~77 | | JdeScoping.DataAccess.Tests | 188 | | JdeScoping.Database.Tests | 0 (placeholder) | | JdeScoping.DataSync.Tests | 54 | | JdeScoping.ExcelExport.Tests | ~45 | | JdeScoping.Host.Tests | 0 (placeholder) | | JdeScoping.Infrastructure.Tests | ~4 |