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:
@@ -45,7 +45,7 @@ public class FeatureServiceTests
|
||||
_db.SetupDbSetWithGeneratedIds(c => c.Tags, _tags);
|
||||
|
||||
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.RecordAsync(
|
||||
It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(),
|
||||
It.IsAny<int>(), It.IsAny<int?>(), It.IsAny<int?>(),
|
||||
|
||||
@@ -43,7 +43,7 @@ public class FeatureStateServiceTests
|
||||
_db.SetupDbSetWithGeneratedIds(c => c.FeatureStates, _featureStates);
|
||||
|
||||
var webhookQueue = new WebhookQueue();
|
||||
var auditService = new Mock<AuditService>(_db.Object, null!, webhookQueue);
|
||||
var auditService = new Mock<IAuditService>();
|
||||
auditService.Setup(a => a.RecordAsync(
|
||||
It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(),
|
||||
It.IsAny<int>(), It.IsAny<int?>(), It.IsAny<int?>(),
|
||||
@@ -154,7 +154,7 @@ public class FeatureStateServiceTests
|
||||
var state = AddState();
|
||||
var queue = new WebhookQueue();
|
||||
|
||||
var auditService = new Mock<AuditService>(_db.Object, null!, queue);
|
||||
var auditService = new Mock<IAuditService>();
|
||||
auditService.Setup(a => a.RecordAsync(
|
||||
It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(),
|
||||
It.IsAny<int>(), It.IsAny<int?>(), It.IsAny<int?>(),
|
||||
|
||||
@@ -41,7 +41,7 @@ public class FeaturesControllerTests
|
||||
_db.SetupDbSetWithGeneratedIds(c => c.Tags, _tags);
|
||||
|
||||
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.RecordAsync(
|
||||
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