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 sealed class AuditLoggerTests
|
||||
repo ??= Substitute.For<IAuditEventRepository>();
|
||||
options ??= new AuditOptions();
|
||||
var optsWrapper = Options.Create(options);
|
||||
return new AuditLogger(context, repo, optsWrapper);
|
||||
return new AuditLogger(context, repo, optsWrapper, TimeProvider.System);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -20,7 +20,7 @@ public sealed class SecurityEventLoggerTests
|
||||
repo ??= Substitute.For<ISecurityEventRepository>();
|
||||
context ??= Substitute.For<IAuditContext>();
|
||||
options ??= new AuditOptions();
|
||||
return new SecurityEventLogger(repo, context, Options.Create(options));
|
||||
return new SecurityEventLogger(repo, context, Options.Create(options), TimeProvider.System);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -22,7 +22,7 @@ public class JwtServiceTests : IDisposable
|
||||
Audience = "sigcm2.web",
|
||||
AccessTokenMinutes = 60
|
||||
};
|
||||
_jwtService = new JwtService(_rsa, _options);
|
||||
_jwtService = new JwtService(_rsa, _options, TimeProvider.System);
|
||||
}
|
||||
|
||||
public void Dispose() => _rsa.Dispose();
|
||||
@@ -219,7 +219,7 @@ public class JwtServiceTests : IDisposable
|
||||
// Sign with a different RSA key
|
||||
using var otherRsa = System.Security.Cryptography.RSA.Create(2048);
|
||||
var otherOptions = new JwtOptions { Issuer = "sigcm2.api", Audience = "sigcm2.web", AccessTokenMinutes = 60 };
|
||||
var otherService = new JwtService(otherRsa, otherOptions);
|
||||
var otherService = new JwtService(otherRsa, otherOptions, TimeProvider.System);
|
||||
var tokenFromOtherKey = otherService.GenerateAccessToken(MakeUsuario());
|
||||
|
||||
// Validating with the correct key should throw
|
||||
|
||||
Reference in New Issue
Block a user