4913a35d06
feat(api): BATCH 5 - PermisosController + tests HTTP [UDT-005]
2026-04-15 15:42:03 -03:00
be2257a9bf
feat(infra): BATCH 4 - Permiso/RolPermiso repos Dapper + tests integracion [UDT-005]
2026-04-15 15:39:25 -03:00
704794a2e2
feat(app): BATCH 3 - handlers permisos con TDD [UDT-005]
2026-04-15 15:31:26 -03:00
f6ad371de4
chore(tests): BATCH 0 - agregar Permiso y RolPermiso a TablesToIgnore [UDT-005]
2026-04-15 15:26:19 -03:00
57e4cdac01
chore(tests): limpia warning xUnit2012 en CreateUsuario_WithInactiveRol_Returns400
...
Reemplaza Assert.True(enumerable.Any(...)) por Assert.Contains idiomatico.
2026-04-15 13:03:18 -03:00
6f999b8fcd
feat(api): UDT-004 controller de roles + refactor validator UDT-003 a lookup dinamico
...
- RolesController /api/v1/roles CRUD admin-only: GET list, GET {codigo}, POST, PUT, DELETE (soft-delete con guard 409)
- ExceptionFilter: mapea RolNotFound (404), RolAlreadyExists (409), RolInUse (409)
- DI: registra 5 handlers de Roles (Application) y IRolRepository/RolRepository (Infrastructure)
- CreateUsuarioCommandValidator: reemplaza whitelist hardcoded por IRolRepository.ExistsActiveByCodigoAsync via MustAsync; constructor recibe (AuthOptions, IRolRepository)
- Tests: 202 verdes (173 application + 29 api). Nuevas: RolesEndpointTests (13 integration), CreateUsuarioCommandValidatorTests reescrito con NSubstitute mock, CreateUsuario_WithInactiveRol_Returns400 en Api.Tests
- Fix: ApiIntegration pasa de IClassFixture (N factories) a ICollectionFixture (1 factory shared) — evitaba ObjectDisposedException sobre RSABCrypt al compartir coleccion con multiples test classes
- tests/tests.runsettings: MaxCpuCount=1 para evitar race entre assemblies sobre SIGCM2_Test
2026-04-15 12:50:24 -03:00
34b714750a
feat(api): UDT-004 dominio + repositorio + application roles (tdd)
...
- Migraciones V003 (tabla Rol + 8 seeds canonicos) y V004 (drop CK + FK Usuario.Rol)
- Dominio: Rol entity + 3 excepciones (RolNotFound/AlreadyExists/InUse)
- Infraestructura: RolRepository (Dapper) con List/Get/ExistsActive/Add/Update/HasActiveUsuarios
- Application: CRUD queries y commands (List, Get, Create, Update, Deactivate) + validators (codigo regex ^[a-z][a-z0-9_]*$)
- Validator UDT-003: whitelist alineada a codigos canonicos (full IRolRepository lookup diferido a Phase 5.1)
- Tests: 169 application + 15 api (todos verdes). Respawn configurado para re-seedear Rol canonical post-reset.
- Estricto TDD: RED/GREEN/TRIANGULATE en todos los handlers nuevos.
2026-04-15 12:31:29 -03:00
3d598faffc
feat(api): UDT-003 registro de usuarios — backend completo (Phases 1-6)
...
- Domain: Usuario.ForCreation factory, UsernameAlreadyExistsException, IUsuarioRepository extendido
- Application: CreateUsuarioCommand/Validator/Handler, UsuarioCreatedDto, AuthOptions password policy
- Infrastructure: UsuarioRepository.ExistsByUsernameAsync + AddAsync (INSERT OUTPUT INSERTED.Id), RoleClaimType="rol" en TokenValidationParameters
- Api: UsuariosController POST api/v1/users [Authorize(Roles="admin")], ExceptionFilter mapea UsernameAlreadyExistsException + SqlException 2627 → 409
- Tests (unit): 43 tests — 33 validator + 10 handler (107 total, green)
- Tests (integration): 7 tests CreateUsuarioEndpoint — 401/403/400/201/409/race/e2e (green)
- Fix: TestWebAppFactory.ConfigureTestServices reemplaza SqlConnectionFactory singleton con CS de test correcto
2026-04-15 10:47:48 -03:00
f1d4ea0047
fix(test): RefreshTokenRepository tests use Respawn pattern instead of transaction isolation
...
Transaction-scoped tests conflicted with the repository opening its own connection,
blocking on FK locks for the uncommitted seeded user and causing timeouts.
Switched to the Respawn pattern used by UsuarioRepositoryTests ([Collection("Database")])
which commits seed data and resets between test classes.
2026-04-14 13:45:53 -03:00
4e7b2690bd
test(api): add Refresh and Logout endpoint integration tests RED
2026-04-14 13:28:44 -03:00
aed26e3de9
feat(infra): register RefreshTokenRepository, RefreshTokenGenerator, ClientContext and handlers in DI
2026-04-14 13:28:36 -03:00
e405c0453b
test(infra): add RefreshTokenRepository integration tests RED
2026-04-14 13:28:28 -03:00
2806e8dfa6
test(infra): add RefreshTokenGenerator tests RED
2026-04-14 13:28:24 -03:00
a363e3658d
test(infra): add GetPrincipalFromExpiredToken tests for JwtService RED
2026-04-14 13:28:20 -03:00
b79efc778a
test(app): extend LoginCommandHandler tests with refresh token persistence cases RED
2026-04-14 13:28:15 -03:00
15a7687e4c
test(app): add LogoutCommandHandler tests RED
2026-04-14 13:28:10 -03:00
25639398c2
test(app): add RefreshCommandHandler tests RED
2026-04-14 13:28:02 -03:00
22aff10330
test(domain): add TokenHasher tests RED
2026-04-14 13:16:43 -03:00
2efe4115c4
test(domain): add RefreshToken entity tests RED
2026-04-14 13:16:36 -03:00
b657dc0d2a
test(udt-001): backend unit and integration tests (30 tests)
2026-04-13 21:36:09 -03:00