Сделать реализацию интерфейсов фабрик явной
ci / build-test (pull_request) Successful in 3m9s

По код-стайлу §11 метод Create реализуется явно
(ISecretCipher ISecretCipherFactory.Create()), интерфейс вызывается
только по порту; тест фабрики типизирован интерфейсом.
This commit is contained in:
2026-09-13 03:59:30 +03:00
parent 3bcf4074b5
commit c7789c0b21
6 changed files with 8 additions and 7 deletions
@@ -45,6 +45,6 @@ public sealed class AiClassifierFactory : IAiClassifierFactory
} }
/// <inheritdoc /> /// <inheritdoc />
public IAiClassifier Create() => IAiClassifier IAiClassifierFactory.Create() =>
new BudgetedAiClassifier(_paidClassifier, _localClassifier, _tenantLimits, _tenantContext, _logger); new BudgetedAiClassifier(_paidClassifier, _localClassifier, _tenantLimits, _tenantContext, _logger);
} }
@@ -40,5 +40,5 @@ public sealed class AiToolsFactory : IAiToolsFactory
} }
/// <inheritdoc /> /// <inheritdoc />
public IAiTools Create() => new BudgetedAiTools(_paidTools, _tenantLimits, _tenantContext, _logger); IAiTools IAiToolsFactory.Create() => new BudgetedAiTools(_paidTools, _tenantLimits, _tenantContext, _logger);
} }
@@ -35,7 +35,7 @@ public sealed class FileStorageFactory : IFileStorageFactory
} }
/// <inheritdoc /> /// <inheritdoc />
public IFileStorage Create() => IFileStorage IFileStorageFactory.Create() =>
_options.Minio.IsConfigured() _options.Minio.IsConfigured()
? new MinioFileStorage(_options.Minio, _minioLogger) ? new MinioFileStorage(_options.Minio, _minioLogger)
: new LocalFileStorage(_localRoot.Path); : new LocalFileStorage(_localRoot.Path);
@@ -27,5 +27,5 @@ public sealed class TenantLimitStoreFactory : ITenantLimitStoreFactory
} }
/// <inheritdoc /> /// <inheritdoc />
public ITenantLimitStore Create() => new TenantLimitStore(_dbContext, _defaults); ITenantLimitStore ITenantLimitStoreFactory.Create() => new TenantLimitStore(_dbContext, _defaults);
} }
@@ -21,5 +21,5 @@ public sealed class SecretCipherFactory : ISecretCipherFactory
} }
/// <inheritdoc /> /// <inheritdoc />
public ISecretCipher Create() => new AesGcmSecretCipher(_keyProvider.GetKey()); ISecretCipher ISecretCipherFactory.Create() => new AesGcmSecretCipher(_keyProvider.GetKey());
} }
@@ -1,4 +1,5 @@
using Deal.Contracts.Integrations.Abstractions; using Deal.Contracts.Integrations.Abstractions;
using Deal.Infrastructure.Integrations.Storage.Abstractions;
using Deal.Infrastructure.Integrations.Storage.Options; using Deal.Infrastructure.Integrations.Storage.Options;
using Deal.Infrastructure.Integrations.Storage.Services; using Deal.Infrastructure.Integrations.Storage.Services;
using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Abstractions;
@@ -14,7 +15,7 @@ public sealed class FileStorageFactoryTests
[Fact] [Fact]
public void Create_MinioNotConfigured_ReturnsLocalFileStorage() public void Create_MinioNotConfigured_ReturnsLocalFileStorage()
{ {
var factory = new FileStorageFactory( IFileStorageFactory factory = new FileStorageFactory(
new StorageOptions(), new StorageOptions(),
new LocalStorageRoot("/tmp/deal-attachments"), new LocalStorageRoot("/tmp/deal-attachments"),
NullLogger<MinioFileStorage>.Instance); NullLogger<MinioFileStorage>.Instance);
@@ -37,7 +38,7 @@ public sealed class FileStorageFactoryTests
SecretKey = "deal-secret", SecretKey = "deal-secret",
}, },
}; };
var factory = new FileStorageFactory( IFileStorageFactory factory = new FileStorageFactory(
options, options,
new LocalStorageRoot("/tmp/deal-attachments"), new LocalStorageRoot("/tmp/deal-attachments"),
NullLogger<MinioFileStorage>.Instance); NullLogger<MinioFileStorage>.Instance);