diff --git a/tests/PowderCoating.UnitTests/SubscriptionServiceTests.cs b/tests/PowderCoating.UnitTests/SubscriptionServiceTests.cs
index be67892..24cb482 100644
--- a/tests/PowderCoating.UnitTests/SubscriptionServiceTests.cs
+++ b/tests/PowderCoating.UnitTests/SubscriptionServiceTests.cs
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
+using PowderCoating.Application.Interfaces;
using PowderCoating.Core.Entities;
using PowderCoating.Core.Enums;
using PowderCoating.Infrastructure.Data;
@@ -23,7 +24,7 @@ public class SubscriptionServiceTests
new ApplicationUser { Id = "u2", CompanyId = 7, UserName = "u2", Email = "u2@example.com", FirstName = "B", LastName = "Two", IsActive = true });
await context.SaveChangesAsync();
- var service = new SubscriptionService(new UnitOfWork(context), context);
+ var service = new SubscriptionService(new UnitOfWork(context), context, new NullPlatformSettingsService());
var (used, max) = await service.GetUserCountAsync(7);
@@ -43,7 +44,7 @@ public class SubscriptionServiceTests
new Job { Id = 3, CompanyId = 8, JobNumber = "JOB-3", CustomerId = 1, Description = "Delivered", JobStatusId = 3, JobPriorityId = 1 });
await context.SaveChangesAsync();
- var service = new SubscriptionService(new UnitOfWork(context), context);
+ var service = new SubscriptionService(new UnitOfWork(context), context, new NullPlatformSettingsService());
var (used, max) = await service.GetJobCountAsync(8);
@@ -76,7 +77,7 @@ public class SubscriptionServiceTests
oldQuote.CreatedAt = DateTime.UtcNow.AddMonths(-1);
await context.SaveChangesAsync();
- var service = new SubscriptionService(new UnitOfWork(context), context);
+ var service = new SubscriptionService(new UnitOfWork(context), context, new NullPlatformSettingsService());
var (used, max) = await service.GetQuoteCountAsync(9);
@@ -94,7 +95,7 @@ public class SubscriptionServiceTests
context.Customers.Add(new Customer { Id = 1, CompanyId = 10, CompanyName = "Customer A" });
await context.SaveChangesAsync();
- var service = new SubscriptionService(new UnitOfWork(context), context);
+ var service = new SubscriptionService(new UnitOfWork(context), context, new NullPlatformSettingsService());
var allowed = await service.CanAddCustomerAsync(10);
@@ -109,7 +110,7 @@ public class SubscriptionServiceTests
context.AiItemPredictions.Add(new AiItemPrediction { Id = 1, CompanyId = 11, CreatedAt = DateTime.UtcNow.AddDays(-1) });
await context.SaveChangesAsync();
- var service = new SubscriptionService(new UnitOfWork(context), context);
+ var service = new SubscriptionService(new UnitOfWork(context), context, new NullPlatformSettingsService());
var allowed = await service.CanUseAiPhotoQuoteAsync(11);
@@ -123,7 +124,7 @@ public class SubscriptionServiceTests
SeedCompanyAndPlan(context, companyId: 12, plan: 6, maxAiPhotoQuotesPerMonth: 10, allowAiPhotoQuotes: false);
await context.SaveChangesAsync();
- var service = new SubscriptionService(new UnitOfWork(context), context);
+ var service = new SubscriptionService(new UnitOfWork(context), context, new NullPlatformSettingsService());
var allowed = await service.CanUseAiPhotoQuoteAsync(12);
@@ -147,7 +148,7 @@ public class SubscriptionServiceTests
});
await context.SaveChangesAsync();
- var service = new SubscriptionService(new UnitOfWork(context), context);
+ var service = new SubscriptionService(new UnitOfWork(context), context, new NullPlatformSettingsService());
var status = await service.GetStatusAsync(20);
@@ -171,7 +172,7 @@ public class SubscriptionServiceTests
});
await context.SaveChangesAsync();
- var service = new SubscriptionService(new UnitOfWork(context), context);
+ var service = new SubscriptionService(new UnitOfWork(context), context, new NullPlatformSettingsService());
var status = await service.GetStatusAsync(21);
@@ -196,7 +197,7 @@ public class SubscriptionServiceTests
});
await context.SaveChangesAsync();
- var service = new SubscriptionService(new UnitOfWork(context), context);
+ var service = new SubscriptionService(new UnitOfWork(context), context, new NullPlatformSettingsService());
var status = await service.GetStatusAsync(22);
@@ -212,7 +213,7 @@ public class SubscriptionServiceTests
company!.AiInventoryAssistEnabled = false;
await context.SaveChangesAsync();
- var service = new SubscriptionService(new UnitOfWork(context), context);
+ var service = new SubscriptionService(new UnitOfWork(context), context, new NullPlatformSettingsService());
var enabled = await service.IsAiInventoryAssistEnabledAsync(13);
@@ -250,7 +251,7 @@ public class SubscriptionServiceTests
});
await context.SaveChangesAsync();
- var service = new SubscriptionService(new UnitOfWork(context), context);
+ var service = new SubscriptionService(new UnitOfWork(context), context, new NullPlatformSettingsService());
var (used, max) = await service.GetJobPhotoCountAsync(14, 100);
@@ -290,7 +291,7 @@ public class SubscriptionServiceTests
});
await context.SaveChangesAsync();
- var service = new SubscriptionService(new UnitOfWork(context), context);
+ var service = new SubscriptionService(new UnitOfWork(context), context, new NullPlatformSettingsService());
var (used, max) = await service.GetQuotePhotoCountAsync(15, 200);
@@ -308,7 +309,7 @@ public class SubscriptionServiceTests
new AiItemPrediction { Id = 2, CompanyId = 16, CreatedAt = DateTime.UtcNow.AddDays(-2) });
await context.SaveChangesAsync();
- var service = new SubscriptionService(new UnitOfWork(context), context);
+ var service = new SubscriptionService(new UnitOfWork(context), context, new NullPlatformSettingsService());
var allowed = await service.CanUseAiPhotoQuoteAsync(16);
@@ -410,3 +411,13 @@ public class SubscriptionServiceTests
});
}
}
+
+/// No-op stub for IPlatformSettingsService — returns defaults for all queries.
+file sealed class NullPlatformSettingsService : IPlatformSettingsService
+{
+ public Task GetAsync(string key) => Task.FromResult(null);
+ public Task GetBoolAsync(string key, bool defaultValue = false) => Task.FromResult(defaultValue);
+ public Task GetIntAsync(string key, int defaultValue) => Task.FromResult(defaultValue);
+ public Task SetAsync(string key, string? value, string? updatedBy = null) => Task.CompletedTask;
+ public Task> GetAllAsync() => Task.FromResult>(Array.Empty().ToList());
+}