Extract IAuditService, drop virtual mock seam from AuditService
Consumers now depend on IAuditService instead of the concrete class, so tests mock the interface (Mock<IAuditService>()) rather than subclassing AuditService via virtual methods.
This commit is contained in:
@@ -41,7 +41,7 @@ public class OrganizationServiceTests
|
||||
_db.SetupDbSet(c => c.Users, _users);
|
||||
|
||||
var webhookQueue = new MicCheck.Api.Webhooks.WebhookQueue();
|
||||
var auditService = new Mock<AuditService>(_db.Object, null!, webhookQueue);
|
||||
var auditService = new Mock<IAuditService>();
|
||||
auditService.Setup(a => a.LogAsync(
|
||||
It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(),
|
||||
It.IsAny<int>(), It.IsAny<int?>(), It.IsAny<int?>(),
|
||||
|
||||
@@ -49,7 +49,7 @@ public class OrganizationsControllerTests
|
||||
_db.SetupDbSetWithGeneratedIds(c => c.Webhooks, _webhooks);
|
||||
|
||||
var webhookQueue = new WebhookQueue();
|
||||
var auditService = new Mock<AuditService>(_db.Object, null!, webhookQueue);
|
||||
var auditService = new Mock<IAuditService>();
|
||||
auditService.Setup(a => a.LogAsync(
|
||||
It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(),
|
||||
It.IsAny<int>(), It.IsAny<int?>(), It.IsAny<int?>(),
|
||||
|
||||
Reference in New Issue
Block a user