Перевести FakeSettingsStore на NSubstitute (42 файла потребителей)

Хелпер Support/TestSettingsStore: словарь настроек, GetAsync/GetAllAsync/SetAsync/
RemoveAsync читают состояние на момент вызова (GetAllAsync — ленивый, ключ для
снапшот-сервисов). DI получает .Store, тесты сохраняют Preload/GetStoredJson.
This commit is contained in:
2026-09-13 01:22:10 +03:00
parent 3ccbe4c9f5
commit d51d88ed65
44 changed files with 327 additions and 315 deletions
@@ -128,7 +128,7 @@ public sealed class BudgetedAiClassifierTests
Context ctx = Create(
limits => limits.Preload(
TenantGuid, budgetTokens: 0, TenantLimitPeriods.Month, PeriodStart, usedTokens: 0));
var standaloneLocal = new LocalAiClassifier(new LocalFieldsParser(ctx.Settings));
var standaloneLocal = new LocalAiClassifier(new LocalFieldsParser(ctx.Settings.Store));
const string text = "Ищем Python-разработчика на проект в команду\nБюджет: до 2к$";
AiParsedCardDto result = await ctx.Decorator.ClassifyAsync(text, CancellationToken.None);
@@ -152,7 +152,7 @@ public sealed class BudgetedAiClassifierTests
private sealed record Context(
IAiClassifier Decorator,
TestAiClassifier Paid,
FakeSettingsStore Settings);
TestSettingsStore Settings);
// Собирает контекст: платный фейк + реальный Local-классификатор + фейк лимитов и tenant-контекст
// (зеркало регистрации AddDealIntegrations при UseLocal=false).
@@ -160,7 +160,7 @@ public sealed class BudgetedAiClassifierTests
// Возвращает: Контекст теста.
private static Context Create(Action<TestTenantLimitStore>? configure = null)
{
var settings = new FakeSettingsStore();
var settings = new TestSettingsStore();
var limits = new TestTenantLimitStore();
configure?.Invoke(limits);
ITenantContext tenantContext = new TenantContext();
@@ -168,7 +168,7 @@ public sealed class BudgetedAiClassifierTests
var paid = new TestAiClassifier();
IAiClassifier decorator = new BudgetedAiClassifier(
paid.Classifier,
new LocalAiClassifier(new LocalFieldsParser(settings)),
new LocalAiClassifier(new LocalFieldsParser(settings.Store)),
limits.Store,
tenantContext,
NullLogger<BudgetedAiClassifier>.Instance);