По код-стайлу §11 метод Create реализуется явно (ISecretCipher ISecretCipherFactory.Create()), интерфейс вызывается только по порту; тест фабрики типизирован интерфейсом.
This commit is contained in:
@@ -45,6 +45,6 @@ public sealed class AiClassifierFactory : IAiClassifierFactory
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IAiClassifier Create() =>
|
||||
IAiClassifier IAiClassifierFactory.Create() =>
|
||||
new BudgetedAiClassifier(_paidClassifier, _localClassifier, _tenantLimits, _tenantContext, _logger);
|
||||
}
|
||||
|
||||
@@ -40,5 +40,5 @@ public sealed class AiToolsFactory : IAiToolsFactory
|
||||
}
|
||||
|
||||
/// <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 />
|
||||
public IFileStorage Create() =>
|
||||
IFileStorage IFileStorageFactory.Create() =>
|
||||
_options.Minio.IsConfigured()
|
||||
? new MinioFileStorage(_options.Minio, _minioLogger)
|
||||
: new LocalFileStorage(_localRoot.Path);
|
||||
|
||||
@@ -27,5 +27,5 @@ public sealed class TenantLimitStoreFactory : ITenantLimitStoreFactory
|
||||
}
|
||||
|
||||
/// <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 />
|
||||
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.Infrastructure.Integrations.Storage.Abstractions;
|
||||
using Deal.Infrastructure.Integrations.Storage.Options;
|
||||
using Deal.Infrastructure.Integrations.Storage.Services;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
@@ -14,7 +15,7 @@ public sealed class FileStorageFactoryTests
|
||||
[Fact]
|
||||
public void Create_MinioNotConfigured_ReturnsLocalFileStorage()
|
||||
{
|
||||
var factory = new FileStorageFactory(
|
||||
IFileStorageFactory factory = new FileStorageFactory(
|
||||
new StorageOptions(),
|
||||
new LocalStorageRoot("/tmp/deal-attachments"),
|
||||
NullLogger<MinioFileStorage>.Instance);
|
||||
@@ -37,7 +38,7 @@ public sealed class FileStorageFactoryTests
|
||||
SecretKey = "deal-secret",
|
||||
},
|
||||
};
|
||||
var factory = new FileStorageFactory(
|
||||
IFileStorageFactory factory = new FileStorageFactory(
|
||||
options,
|
||||
new LocalStorageRoot("/tmp/deal-attachments"),
|
||||
NullLogger<MinioFileStorage>.Instance);
|
||||
|
||||
Reference in New Issue
Block a user