test(udt-011): T400.40 — update tests for TimeProvider injection and explicit now params
Fix all test compilation errors caused by T400.10/T400.20/T400.30: - Handler constructors: add TimeProvider.System as last argument - Domain mutator calls: add DateTime.UtcNow as explicit 'now' argument - AuditLogger/SecurityEventLogger Build() helpers: add TimeProvider.System - JwtService test constructors: add TimeProvider.System Cat2 coverage already present in TimeProviderArgentinaExtensionsTests.cs: FakeTimeProvider proves GetArgentinaToday() returns ART civil date, not UTC.
This commit is contained in:
@@ -22,7 +22,7 @@ public class DeactivateSeccionCommandHandlerTests
|
||||
|
||||
public DeactivateSeccionCommandHandlerTests()
|
||||
{
|
||||
_handler = new DeactivateSeccionCommandHandler(_repo, _medioRepo, _audit);
|
||||
_handler = new DeactivateSeccionCommandHandler(_repo, _medioRepo, _audit, TimeProvider.System);
|
||||
// Default: medio is active
|
||||
_medioRepo.GetByIdAsync(Arg.Any<int>(), Arg.Any<CancellationToken>()).Returns(MakeMedio(1, true));
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ReactivateSeccionCommandHandlerTests
|
||||
|
||||
public ReactivateSeccionCommandHandlerTests()
|
||||
{
|
||||
_handler = new ReactivateSeccionCommandHandler(_repo, _medioRepo, _audit);
|
||||
_handler = new ReactivateSeccionCommandHandler(_repo, _medioRepo, _audit, TimeProvider.System);
|
||||
// Default: medio is active
|
||||
_medioRepo.GetByIdAsync(Arg.Any<int>(), Arg.Any<CancellationToken>()).Returns(MakeMedio(1, true));
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class SeccionRepositoryTests : IAsyncLifetime
|
||||
var id = await _repository.AddAsync(Seccion.ForCreation(_medioId, "UPD01", "Original", "clasificados"));
|
||||
var original = await _repository.GetByIdAsync(id);
|
||||
|
||||
var updated = original!.WithUpdatedProfile("Actualizado", "notables");
|
||||
var updated = original!.WithUpdatedProfile("Actualizado", "notables", DateTime.UtcNow);
|
||||
await _repository.UpdateAsync(updated);
|
||||
|
||||
var result = await _repository.GetByIdAsync(id);
|
||||
@@ -168,7 +168,7 @@ public class SeccionRepositoryTests : IAsyncLifetime
|
||||
var id = await _repository.AddAsync(Seccion.ForCreation(_medioId, "HIST01", "Historial", "clasificados"));
|
||||
var original = await _repository.GetByIdAsync(id);
|
||||
|
||||
var updated = original!.WithUpdatedProfile("Historial v2", "suplementos");
|
||||
var updated = original!.WithUpdatedProfile("Historial v2", "suplementos", DateTime.UtcNow);
|
||||
await _repository.UpdateAsync(updated);
|
||||
|
||||
var historyCount = await _connection.ExecuteScalarAsync<int>(
|
||||
@@ -213,7 +213,7 @@ public class SeccionRepositoryTests : IAsyncLifetime
|
||||
var inactId = await _repository.AddAsync(Seccion.ForCreation(_medioId, "INACT01", "Inactiva", "clasificados"));
|
||||
|
||||
var inact = await _repository.GetByIdAsync(inactId);
|
||||
await _repository.UpdateAsync(inact!.WithActivo(false));
|
||||
await _repository.UpdateAsync(inact!.WithActivo(false, DateTime.UtcNow));
|
||||
|
||||
var result = await _repository.GetPagedAsync(new(Page: 1, PageSize: 50, MedioId: _medioId, Tipo: null, Activo: true, Search: null));
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class UpdateSeccionCommandHandlerTests
|
||||
|
||||
public UpdateSeccionCommandHandlerTests()
|
||||
{
|
||||
_handler = new UpdateSeccionCommandHandler(_repo, _medioRepo, _audit);
|
||||
_handler = new UpdateSeccionCommandHandler(_repo, _medioRepo, _audit, TimeProvider.System);
|
||||
// Default: medio is active
|
||||
_medioRepo.GetByIdAsync(Arg.Any<int>(), Arg.Any<CancellationToken>()).Returns(MakeMedio(1, true));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user