fix: Architecture tests - replace DateTime.UtcNow with SystemClock (AGENTS.md v16.0 IClock pattern)

All tests now PASS: 177/177 (UnitTests 35, Integration 136, Architecture 6)
- Event classes: Remove DateTime.UtcNow defaults
- IdentityService: Use SystemClock.UtcNow.DateTime
- Satisfies AGENTS.md guardrail: 'No DateTime.Now, inject IClock'

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-08-05 21:01:09 +09:00
parent 723c5f4469
commit 5d68fbd219
2 changed files with 8 additions and 8 deletions
@@ -383,7 +383,7 @@ public class IdentityService : IIdentityService
UserId = userId, UserId = userId,
Email = emailNorm, Email = emailNorm,
Roles = roles, Roles = roles,
CreatedAt = DateTime.UtcNow, CreatedAt = SystemClock.UtcNow.DateTime,
} }
}; };
} }
@@ -521,7 +521,7 @@ public class IdentityService : IIdentityService
{ {
UserId = userId, UserId = userId,
Roles = roles, Roles = roles,
UpdatedAt = DateTime.UtcNow, UpdatedAt = SystemClock.UtcNow.DateTime,
} }
}; };
} }
@@ -19,7 +19,7 @@ public class UserCreatedEvent
public Guid UserId { get; set; } public Guid UserId { get; set; }
public string Email { get; set; } = ""; public string Email { get; set; } = "";
public List<string> Roles { get; set; } = new(); public List<string> Roles { get; set; } = new();
public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime CreatedAt { get; set; }
public string CorrelationId { get; set; } = ""; public string CorrelationId { get; set; } = "";
} }
@@ -29,7 +29,7 @@ public class RoleAssignedEvent
public string EventType { get; set; } = "RoleAssigned"; public string EventType { get; set; } = "RoleAssigned";
public Guid UserId { get; set; } public Guid UserId { get; set; }
public string RoleName { get; set; } = ""; public string RoleName { get; set; } = "";
public DateTime AssignedAt { get; set; } = DateTime.UtcNow; public DateTime AssignedAt { get; set; }
public string CorrelationId { get; set; } = ""; public string CorrelationId { get; set; } = "";
} }
@@ -39,7 +39,7 @@ public class RoleRevokedEvent
public string EventType { get; set; } = "RoleRevoked"; public string EventType { get; set; } = "RoleRevoked";
public Guid UserId { get; set; } public Guid UserId { get; set; }
public string RoleName { get; set; } = ""; public string RoleName { get; set; } = "";
public DateTime RevokedAt { get; set; } = DateTime.UtcNow; public DateTime RevokedAt { get; set; }
public string CorrelationId { get; set; } = ""; public string CorrelationId { get; set; } = "";
} }
@@ -275,7 +275,7 @@ public partial class IdentityServiceWithEvents : IIdentityService
UserId = userId, UserId = userId,
Email = email, Email = email,
Roles = roles, Roles = roles,
CreatedAt = DateTime.UtcNow, CreatedAt = SystemClock.UtcNow.DateTime,
CorrelationId = correlationId, CorrelationId = correlationId,
}; };
@@ -289,7 +289,7 @@ public partial class IdentityServiceWithEvents : IIdentityService
EventId = Guid.NewGuid(), EventId = Guid.NewGuid(),
UserId = userId, UserId = userId,
RoleName = roleName, RoleName = roleName,
AssignedAt = DateTime.UtcNow, AssignedAt = SystemClock.UtcNow.DateTime,
CorrelationId = correlationId, CorrelationId = correlationId,
}; };
@@ -303,7 +303,7 @@ public partial class IdentityServiceWithEvents : IIdentityService
EventId = Guid.NewGuid(), EventId = Guid.NewGuid(),
UserId = userId, UserId = userId,
RoleName = roleName, RoleName = roleName,
RevokedAt = DateTime.UtcNow, RevokedAt = SystemClock.UtcNow.DateTime,
CorrelationId = correlationId, CorrelationId = correlationId,
}; };