chore: refactor to separate files

This commit is contained in:
Stevan Freeborn
2024-08-12 12:42:16 -05:00
parent 75287e2d4c
commit 0353852330
6 changed files with 36 additions and 17 deletions
@@ -0,0 +1,5 @@
namespace SanctionsSearch.Worker.Tests.Unit;
public class OfacFileServiceOptionsTests
{
}
@@ -8,3 +8,4 @@ global using Moq;
global using RichardSzalay.MockHttp; global using RichardSzalay.MockHttp;
global using SanctionsSearch.Worker.Services; global using SanctionsSearch.Worker.Services;
global using SanctionsSearch.Worker.Options;
@@ -0,0 +1,5 @@
namespace SanctionsSearch.Worker.Interfaces;
interface IOfacFileService
{
}
@@ -0,0 +1,23 @@
namespace SanctionsSearch.Worker.Options;
class OfacFileServiceOptions
{
public string Url { get; init; } = string.Empty;
public string SdnFileName { get; init; } = string.Empty;
public string AddressFileName { get; init; } = string.Empty;
public string AltNamesFileName { get; init; } = string.Empty;
public string CommentsFileName { get; init; } = string.Empty;
public string ConPrimaryNameFileName { get; init; } = string.Empty;
public string ConAddressesFileName { get; init; } = string.Empty;
public string ConAltNamesFileName { get; init; } = string.Empty;
public string ConCommentsFileName { get; init; } = string.Empty;
public Uri GetSdnFileUri() => new($"{Url}/{SdnFileName}");
public Uri GetAddressFileUri() => new($"{Url}/{AddressFileName}");
public Uri GetAltNamesFileUri() => new($"{Url}/{AltNamesFileName}");
public Uri GetCommentsFileUri() => new($"{Url}/{CommentsFileName}");
public Uri GetConPrimaryNameFileUri() => new($"{Url}/{ConPrimaryNameFileName}");
public Uri GetConAddressesFileUri() => new($"{Url}/{ConAddressesFileName}");
public Uri GetConAltNamesFileUri() => new($"{Url}/{ConAltNamesFileName}");
public Uri GetConCommentsFileUri() => new($"{Url}/{ConCommentsFileName}");
}
@@ -1,9 +1,5 @@
namespace SanctionsSearch.Worker.Services; namespace SanctionsSearch.Worker.Services;
interface IOfacFileService
{
}
class OfacFileService( class OfacFileService(
HttpClient client, HttpClient client,
ILogger<OfacFileService> logger, ILogger<OfacFileService> logger,
@@ -14,16 +10,3 @@ class OfacFileService(
private readonly ILogger<OfacFileService> _logger = logger ?? throw new ArgumentNullException(nameof(logger)); private readonly ILogger<OfacFileService> _logger = logger ?? throw new ArgumentNullException(nameof(logger));
private readonly OfacFileServiceOptions _options = options?.Value ?? throw new ArgumentNullException(nameof(options)); private readonly OfacFileServiceOptions _options = options?.Value ?? throw new ArgumentNullException(nameof(options));
} }
class OfacFileServiceOptions
{
public string Url { get; set; } = string.Empty;
public string SdnFileName { get; set; } = string.Empty;
public string AddressFileName { get; set; } = string.Empty;
public string AltNamesFileName { get; set; } = string.Empty;
public string CommentsFileName { get; set; } = string.Empty;
public string ConPrimaryNameFileName { get; set; } = string.Empty;
public string ConAddressesFileName { get; set; } = string.Empty;
public string ConAltNamesFileName { get; set; } = string.Empty;
public string ConCommentsFileName { get; set; } = string.Empty;
}
+2
View File
@@ -1,5 +1,7 @@
global using Microsoft.Extensions.Options; global using Microsoft.Extensions.Options;
global using SanctionsSearch.Worker.Interfaces;
global using SanctionsSearch.Worker.Options;
global using SanctionsSearch.Worker; global using SanctionsSearch.Worker;
global using Serilog; global using Serilog;